Arrow Functions
Short syntax for writing functions.
Examples
Basic Arrow Function
Standard arrow function syntax.
const add = (a, b) => {
return a + b;
};
console.log(add(5, 3)); // 8Concise One-Liner
Implicit return when curly braces are omitted.
const multiply = (a, b) => a * b;
console.log(multiply(4, 5)); // 20Single Parameter
Parentheses are optional for a single parameter.
const greet = name => "Hello " + name;
console.log(greet("Bob"));Test Your Knowledge
JavaScript Quiz
No quiz available for this topic yet.