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);