What is a pure function?
A function that:
- Always returns the same output for the same input
- Has no side effects (doesn’t modify external variables)
Example:
function sum(a, b) {
return a + b;
A function that:
Example:
function sum(a, b) {
return a + b;