Passing Arrays as Function Arguments
If you want to pass an array into a variadic function. You can use ES6 spread to turn that array into a list of arguments. Yay, so much cleaner and no useless null from the old apply way 👏
function sandwich(a, b, c) {
console.log(a) // '🍞'
console.log(b) // '🥬'
console.log(c) // '🥓'
}const food = ['🍞', '🥬', '🥓'];// Old way…