What is spread operator in ES6 ?
Spread Operator allows to get the list of paramaters from array Spread operator syntax allows an iterable
The below is an example of spread operator
function hello(a,b,c){
console.log(a + " " + b + " "+ c)
}
var printNum = [10,22,33]
hello(...printNum)
Example 2
Here is an example of array , to break the array to string and get it in one sentence we can use the spread operator , a spread operation in the below example is '...bestStockToBy'
var bestStockToBy = ['Best Stocks To Buy for 2019 are ', " TCS" ," Infosys", "SBI", "L&T"]
console.log(...bestStockToBy)
Spread Operator allows to get the list of paramaters from array Spread operator syntax allows an iterable
The below is an example of spread operator
function hello(a,b,c){
console.log(a + " " + b + " "+ c)
}
var printNum = [10,22,33]
hello(...printNum)
Example 2
Here is an example of array , to break the array to string and get it in one sentence we can use the spread operator , a spread operation in the below example is '...bestStockToBy'
var bestStockToBy = ['Best Stocks To Buy for 2019 are ', " TCS" ," Infosys", "SBI", "L&T"]
console.log(...bestStockToBy)
Comments
Post a Comment