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