What is an arrow function

An arrow function is a concise way to write function expressions in JavaScript. Introduced in ES6 (ECMAScript 2015), they provide a more succinct syntax compared to traditional function expressions. Arrow functions do not bind their own `this`, making them particularly useful for certain scenarios, such as in callbacks or methods that rely on the context of the surrounding code.

arrow function, JavaScript, ES6, function expression, concise syntax
An arrow function is a modern syntax for writing functions in JavaScript, allowing for cleaner and more readable code.

const sum = (a, b) => a + b;
console.log(sum(5, 3)); // Output: 8
    

arrow function JavaScript ES6 function expression concise syntax