JavaScript

What is a pure function?

Medium
4
Added
A function that always returns same output for same inputs and has no side effects.

Solution Code

JavaScript
const add = (a, b) => a + b;
Explanation
Pure functions are predictable and easier to test/debug.

Guided Hints

Compare with impure functions
What constitutes a side effect?