Rest paramenters
const integers = [-1, 0, 32, -101, 24]
Math.max(...integers)
// ES5 —————————————————————————————————————————————————————————————
Math.max.apply(null, integers)const plusCount = (first, ...rest) =>
rest.reduce((sum, next) => sum + next, first)
// ES5 —————————————————————————————————————————————————————————————
function plusCount() {
var first = arguments[0];
var rest = [].slice.call(arguments, 1);
return rest.reduce(function(sum, next) {
return sum + next;
}, first);
}Last updated