Arrow functions
Arrow functions is one of the important concept of ES6 , Arrow fucntions takes few lines of code when a developer tries to create it
For Example : We will create a function to return the name of the multibagger stock, so in this program we will create a fucntion by name multiBaggerStock and a parameter will be passed
function multiBaggerStocks (stocksName) {
return stocksName
} ;
console.log(multiBaggerStocks("SBI"));
Output : SBI
The above function can be rewritten in arrow fucntion as below
multiBaggerStocks1 = stockName => stockName; console.log(multiBaggerStocks1("SBIIN"));
Arrow functions is one of the important concept of ES6 , Arrow fucntions takes few lines of code when a developer tries to create it
For Example : We will create a function to return the name of the multibagger stock, so in this program we will create a fucntion by name multiBaggerStock and a parameter will be passed
function multiBaggerStocks (stocksName) {
return stocksName
} ;
console.log(multiBaggerStocks("SBI"));
Output : SBI
The above function can be rewritten in arrow fucntion as below
multiBaggerStocks1 = stockName => stockName; console.log(multiBaggerStocks1("SBIIN"));
Comments
Post a Comment