javascript ... spread code example
Example 1: spread operator javascript
obj = {first_name : "Marty",
lovers: ["Jennifer Parker","Baines McFly"]
};
let objClone = { ...obj };
console.log(objClone)
Example 2: spread operator javascript
const parts = ['shoulders', 'knees'];
const lyrics = ['head', ...parts, 'and', 'toes'];
Example 3: spread operator javascript
[a, b, ...objIteravel] = [1, 2, 3, 4, 5];
Example 4: javascript spread operator
function myFunction(v, w, x, y, z) { }
let args = [0, 1];
myFunction(-1, ...args, 2, ...[3]);