
Arrow Functions in JavaScript: A Simpler Way to Write Functions
In ES6, arrow functions are the compact syntax for functions, it is just like abbreviation for functions and it is recommended that you should harness the power of arrow function,without dealing with the hoisting, arrow functions are considered as Function Expressions, that a lot look like function definition. It is the main advantage of arrow functions are not hoisted to the top of the scope ,and because the function expresions which are objects, we can't hoist the objects, and we recomend you to create the function object using the const keyword. const square=(number)=>{return number*number;} This syntax is similar to mathematical notation => (“arrow”) that separate the function parameters from the function body. We don't employed the function keyword, we can pass the parameters as agrugment inside the curly brashes and in case of one single statement,for returning we can omit the return keyword, small brackets and the curly brashes to. const square=number=>number*number; Arrow funct
Continue reading on Dev.to JavaScript
Opens in a new tab




