- Home
- /
- Tutorials
- /
- JavaScript Tutorial
- /
- JavaScript Arrow Functions
JavaScript Functions
JavaScript Arrow Functions
JavaScript arrow functions are a shorter way to write a function expression.
An arrow function uses => instead of the word function.
They are especially common as callbacks passed to array methods.
Example
Example
javascript
const double = (n) => {
return n * 2;
};
console.log(double(8));This does exactly the same job as a function expression.
The output is 16.
