📚 › JavaScript: make pages do things
8. Arrow functions
Este artículo se traducirá automáticamente. Por ahora se muestra en inglés.
An arrow function is a short way to write a function: (a, b) => a + b. With one expression, the return is implied.
Arrow functions are common in modern code, for example inside forEach and map.
Ver ejemplo
const add = (a, b) => a + b;
console.log(add(2, 3));
✍️ Ahora te toca
Write an arrow function square that returns n times n, then print square(7).