resting and spreading arrays javascript code example
Example 1: spread operator javascript
[a, b, ...objIteravel] = [1, 2, 3, 4, 5];
Example 2: how to assign an rest operator in javascript
function multiply(multiplier, ...theArgs) {
return theArgs.map(element => {
return multiplier * element
})
}
let arr = multiply(2, 1, 2, 3)
console.log(arr) // [2, 4, 6]