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
related reading
- Functions — reusable blocks of code - Learn web development | MDNdeveloper.mozilla.org
- TypeScript: Documentation - More on Functionstypescriptlang.org
- What is ‘this’ in React?medium.com
- Build your own Reactpomb.us
- What the fuck is a closure? ・ Dan’s JavaScript Glossarywhatthefuck.is
- TypeScript: Documentation - The Basicstypescriptlang.org
- Notes on structured concurrency, or: Go statement considered harmful - njs blogvorpus.org
- Classes - JavaScript | MDNdeveloper.mozilla.org
- Methods - The Rust Programming Languagedoc.rust-lang.org
- JS cheat sheetprogramming-idioms.org
- 'return await promise' vs 'return promise' in JavaScriptdmitripavlutin.com
- Reading 15: Promisesweb.mit.edu