//three dots(...) is called spread operator
// Use of spread operator in Array
const summerFlower = ["Rose","Sunflower"];
const winterFlower = ["Marigold","Tulip","Lily"];
const flower = [...summerFlower, ...winterFlower];
console.log(flower);
const [flora, ...flwr] = [...summerFlower, ...winterFlower];
console.log(flora);
console.log(flwr);
// Use of spread operator in object
const fullForm = {
"php" : "Hypertext Preprocessor",
"html" : "Hyper Text Markup Language"
}
const fullFormMore = {
...fullForm,
"css" : "Cascading Style Sheet"
}
console.log(fullFormMore);
No comments:
Post a Comment