Arrow function Introduced in ES6. They provide concise syntax to write a standard function.
Standard Function :
function add ( a , b ){ return a + b ; }
Enter fullscreen mode
Exit fullscreen mode
Arrow Function :
const add = ( a , b ) => a + b ;
Enter fullscreen mode
Exit fullscreen mode
Arrow function are anonymous don't have name . You cannot give it a name during definition.
Assigned to Variables : To reuse or reference an arrow function, you must assign it to a variable (e.g., const myFunc = () => { ... }; ).
const greet = () => { console . log ( " Hello " ); };
greet (); // reuse greet (); // reuse again
Enter fullscreen mode
Exit fullscreen mode
They are design for inline code that and reduce syntax .…