javascript
Arrow Function in JavascriptjavascriptLevel1
Progress0%
Contents
Arrow Function in Javascript
1 / 12
Introduction
Arrow Functions
An arrow function is a shorter, more concise syntax for writing function expressions. Introduced in ES6 (2015), arrow functions are now the most commonly written function syntax in modern JavaScript.
codejs
1// Regular function expression
2const add = function (a, b) {
3 return a + b;
4};
5
6// Arrow function — same behaviour, shorter syntax
7const add = (a, b) => {
8 return a + b;
9};