Functions

Functions in JavaScript

Functions are reusable blocks of code that perform specific tasks.

Code Examples
// Function declaration\nfunction greet(name) {\n    return `Hello, ${name}!`;\n}\n\n// Arrow function\nconst add = (a, b) => a + b;\n\nconsole.log(greet("World"));\nconsole.log(add(5, 3));