Arrow functions were introduced in ES6.
Arrow functions allow us to write shorter function syntax :
let myFunction = (a, b) => a * b;
Before Arrow:
hello = function() {
return "Hello World!";
}
With Arrow Function:
hello = () => {
return "Hello World!";
}
It gets shorter! If the function has only one statement, and the statement returns a value, you can remove the brackets and the return
keyword : Continue reading JavaScript Arrow Function