js spread function arguments code example
Example 1: spread and rest operator javascript
var myName = ["Marina" , "Magdy" , "Shafiq"] ;const [firstName , ...familyName] = myName ;console.log(firstName);
Example 2: js spread parameters
let list = ['a','b','c'];
let copy = [...list, 'd', 'e'];
function toDoList(...todos) {
document.write(
`<ul>${todos.map((todo) => `<li>${todo}</li>`).join("")}</ul>`
);
}
toDoList("wake up", "eat breakfast", ...list);
Example 3: spread and rest operator javascript
function myData(...args){console.log(args) ;