require spread code example
Example 1: spread operator in javascript
let numList = [1,2,3];
let numListClone = [...numList];
let animal = {
name: 'dog',
color: 'brown',
age: 7
};
let { age, ...otherProperties } = animal;
function sum(x, y, ...rest) {}
let numLists = [...numList1, ...numList2];
let animalWithBreed = {
...animal,
breed: '',
}
Example 2: spread and rest operator javascript
var myName = ["Marina" , "Magdy" , "Shafiq"] ;const [firstName , ...familyName] = myName ;console.log(firstName);