let str = readline(); let arr = str.split(" "); let max = 0; // 注意数组的元素是string类型,需要使用Number()转换 let i = 0, len = arr.length; for (; i < len; i++) { if (Number(arr[i]) > max) { max = arr[i]; } } console.log(max);
let str = readline(); let arr = str.split(" "); // 数组的扩展:将一个数组转为参数序列 console.log(Math.max(...arr));