Arrow Function

Shafiq Hammad
May 6, 2021

Arrow Function introduced In ES6. It’s also called Fat Arrow Function. It’s not a new thing. just a Syntactic Sugar. It looks nice and clean. between es5 function and arrow function a little bit different. We write function expression in es5 like this:

var demoFunc = function() {
console.log('A Demo ES5 Function Expression');
}

and in arrow function we write this function like this:

const demoFunc = () => console.log('A Demo ES6 Arrow Function');

what’s the difference between these functions.

In the arrow function, we write => this instant of function keyword. and in es5 we need to write multiline code but in the arrow function, just one line of code and we don’t need the {}. it’s the beauty of the arrow function.

--

--