rest operator and spread operator in javascript code example
Example 1: spread and rest javascript
var myName = ["Marina" , "Magdy" , "Shafiq"] ;const [firstName , ...familyName] = myName ;console.log(firstName); // Marina ;console.log(familyName); // [ "Magdy" , "Shafiq"] ;
Example 2: spread and rest operator javascript
function myData(...args){console.log(args) ; // ["Marina",24,"Front-End Developer"]}myData("Marina",24,"Front-End Developer") ;