MY #100 DAYS OF CODE CHALLENGE JOURNEY-DAY 13

in coding •  6 years ago 

IMG_20190215_173911.jpg

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.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!