flâneur — a map of the web's best reading

5 Differences Between Arrow and Regular Functions

dmitripavlutin.com · 1,631 words · saved by 1 readers

The 5 must-know differences between arrow and regular functions in JavaScript.

5 Differences Between Arrow and Regular Functions Updated March 21, 2023 javascript function arrow function -- Comments You can define JavaScript functions in many ways . The first, usual way, is by using the function keyword: // Function declaration function greet(who) { return `Hello, ${who}!`; } // Function expression const greet = function(who) { return `Hello, ${who}`; } The function declaration and function expression I'm going to reference as regular function . The second way, available starting ES2015, is the arrow function syntax: const greet = (who) => { return `Hello, ${who}!`; } Wh

Explore this link on the map →

related reading