| 1. |
What Is Spread Operator In Es6? |
|
Answer» Spread Operator PROVIDES a new way to MANIPULATE array and objects in Es6.A Spread operator is represented by … followed by the variable name. let a =[7,8,9]; let b=[1,2,3,...a,10]; console.log(b); // [1,2,3,7,8,9,10] So spread operator SPREADS the contents of variable a and CONCATENATES it in b. Another Example function print(...z){ console.log (z); } print(1,2,3,4);//[1,2,3,4] Spread Operator provides a new way to manipulate array and objects in Es6.A Spread operator is represented by … followed by the variable name. Example: let a =[7,8,9]; let b=[1,2,3,...a,10]; console.log(b); // [1,2,3,7,8,9,10] So spread operator spreads the contents of variable a and concatenates it in b. Another Example function print(...z){ console.log (z); } print(1,2,3,4);//[1,2,3,4] |
|