1️⃣ Function Declaration
A Function Declaration defines a function using the function keyword with a name.
Hoisted (can be used before it is defined)
Has a function name
Commonly used for reusable logic
console.log(add(2, 3)); // ✅ Works
function add(a, b) {
return a + b;
}

A Function Expression assigns a function to a variable.
const add = function(a, b) {
return a + b;
};
Not hoisted like function declarations
Stored in a variable
Can be anonymous
console.log(add(2, 3)); // ❌ Error
const add = function(a, b) {
return a + b;
};

Arrow functions are a shorter syntax for writing function expressions.
Normal Function
✅ Shorter syntax
✅ No function keyword
✅ Implicit return (for single expressions)
0
8
0