Arrow functions make small functions neat.
Direct answer
An arrow function is a compact way to write a function using =>. If the body is a single expression, the result is returned automatically. Arrow functions do not have their own this, which is useful in callbacks but wrong for object methods that rely on this.
Syntax
// regular
function add(a, b) {
return a + b;
}
// arrow
const add = (a, b) => a + b;
// one parameter
const double = n => n * 2;
// multiple lines
const greet = (name) => {
const message = "Hi " + name;
return message;
};
Great in callbacks
const numbers = [1, 2, 3];
const doubled = numbers.map(n => n * 2);
When not to use them
- Object methods that need
this. - Constructors (
newwill fail). - Functions that need
arguments.
Where Teyro fits
Teyro's JavaScript for Beginners course turns this into short lessons you can play in a few minutes a day. It has 50 lessons, and you can start free.
The bottom line
Use arrow functions for short callbacks and utilities. Use regular functions when you need this.



