Destructuring

 let names=["abhi","ash","bharath","vinay","ran","bala"];

console.log(names);
let[winner,runner]=names;
console.log(winner);
console.log(runner);

let [first,second,third,...others]=names;
console.log(first);
console.log(second);
console.log(third);
console.log("Others:",...others);



Comments

Popular posts from this blog

Callback Hell

TODO list with DOM

Refactoring callback hell code