Arrow functions are used to define shorter functions as per the syntax.
-
Syntax of Arrow function
const nameOfFunction = (parameters) => { //statements }; nameOfFunction(arguments)
-
We can remove the parenthesis
()if we have only one parameter.const greet = avenger => { return `Hello, ${avenger}` };
-
We can remove the flower brackets
{}if we have single statement which is returning something.const greet = avenger => `Hello, ${avenger}`;