const times = function (...params) { let [s, ...opts] = params console.log(opts) for (var i = 0; i < opts.length; i++) { s *= opts[i]; } return s } let arr = [1,2,3,4] console.log(times(...arr)) console.log(arr) const e = arr.reduce((a,b) => { return a * b },1) console.log(e)