add()
add(
augend,addend):number
Adds two numbers.
DEPRECATED
Use the + operator directly instead.
Parameters
augend: number
The first number in an addition.
addend: number
The second number in an addition.
Returns: number
The sum.
See Also
Since
2.0.0
Also known as
add (Lodash, Ramda) · ❌ (es-toolkit, Remeda, Radashi, Effect, Modern Dash, Antfu)
Example
// ❌ Deprecated approach
add(6, 4); // => 10
// ✅ Recommended approach
6 + 4; // => 10
How it works?
Adds two numbers.
Deprecated: Use the + operator directly.
Native Equivalent
// ❌ add(6, 4)
// ✅ 6 + 4
Use Cases
Add numbers 📌
Add two numbers.
a + b;
Accumulate values
Sum array of numbers.
const total = numbers.reduce((a, b) => a + b, 0);