Get To Know About Arrow Function In JavaScript
Function are building blocks of any Program.Help to Structure program. Allow called them as many times with rewriting code.
I this Post, We will Discuss About Arrow Function In JavaScript and Compare Them With Tradition way of writing function in JavaScript.
What are the Function in JavaScript?
Function are block which use to create large and complex program.
This a function which will return sum of two number,tradition way to create or defined a function in JS.
What is Arrow Function in JavaScript And Advantage.
Arrow function are small, in term of syntax. Arrow function are introduced in ES6, Arrow function are more readable, small in syntax and make code or structured.
This is a arrow function which return sum of two number.
Advantage of arrow function-
1. Code size: When we use the syntax of arrow function, the size of the code gets reduced. We can write less amount of code by using the arrow function.
2. Single line functions: In ES5, we need to define the return statement in the functions, but in ES6, we do not require to define the return statement for single-line functions.