Arrow Functions
Learn the shorter arrow function syntax and when to use it.
Step 1 of 5
A shorter way to write functions
ES6 (2015) introduced arrow functions — a more compact syntax for writing functions. Instead of the `function` keyword, you use a fat arrow `=>` between the parameters and the body. Arrow functions are especially popular for short, simple functions and when passing functions as arguments (which you'll do a lot with array methods). They aren't a complete replacement for regular functions — each has its place — but for most beginner use cases, they're interchangeable.
Think of it this way: Arrow functions are like text message abbreviations — 'see you later' becomes 'cya l8r.' Same meaning, fewer characters. Just like abbreviations are great for quick texts but you'd use full words in a formal letter, arrow functions are perfect for short helper functions but you might prefer declarations for big, important ones.
Web Standard
Arrow functions were introduced in ECMAScript 2015 (ES6). They have a key technical difference from regular functions: they do not have their own `this` binding. For now this won't matter, but it becomes important later when working with objects and event handlers.
Learn more on MDN
JAVASCRIPTREAD ONLY
CONSOLE
Click "Run" to execute your code...