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
Post a Comment