MY #100 DAYS OF CODE CHALLENGE JOURNEY-DAY 13
Welcome to my daily 100days of code challenge once again and today, I am going to discuss about arrow functions.
Arrow function as a new feature in ES6 was introduced as a way of making the syntax of functions easier. It simplifies and compacts function syntax.
Functions are written in the earlier versions of JavaScript as below:
let doWork = function (x,y) {
return x+y;
}
The above function doWork() takes two parameters and return their sum. From the above function declaration, the keyword is involved.
To write doWork() function using the arrow function, we simply eliminate the function keyword and replace it with the symbols =>
let doWork = (x+y) => x+y;
This is just a simple use of arrow function above.