ES5和ES6如何取數(shù)組的最大值:
//?ES5?的寫法
Math.max.apply(null,?[14,?3,?77,?30]);
//?ES6?的寫法
Math.max(...[14,?3,?77,?30]);
//?reduce
[14,3,77,30].reduce((accumulator,?currentValue)=>{
????return?accumulator?=?accumulator?>?currentValue???accumulator?:?currentValue
});