Starlit Daily

📚 › JavaScript: make pages do things

8. Arrow functions

इस लेख का अनुवाद अपने आप होगा। अभी अंग्रेज़ी में दिखाया जा रहा है।

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.

उदाहरण देखें

const add = (a, b) => a + b;
console.log(add(2, 3));

✍️ अब आपकी बारी

Write an arrow function square that returns n times n, then print square(7).

← कोर्स पर वापस