Home > Q&A > body text
Write a function in js, without limiting the number of parameters, and return the maximum value of all parameters
天蓬老师2017-05-19 10:29:56
function maxNum(){return Math.max.apply(null,arguments)}
PHP中文网2017-05-19 10:29:56
function maxNum(...args){ return Math.max(...args) } maxNum(0,1,2,3,4,5,6,7,8,9); //9