divide()
divide(
dividend,divisor):number
Divides two numbers.
DEPRECATED
Use the / operator directly instead.
Parametersβ
dividend: numberβ
The first number in a division.
divisor: numberβ
The second number in a division.
Returns: numberβ
The quotient.
See Alsoβ
Sinceβ
2.0.0
Also known asβ
divide (Lodash, Ramda) Β· β (es-toolkit, Remeda, Radashi, Effect, Modern Dash, Antfu)
Exampleβ
// β Deprecated approach
divide(6, 4); // => 1.5
// β
Recommended approach
6 / 4; // => 1.5
How it works?β
Divides two numbers.
Deprecated: Use the / operator directly.
Native Equivalentβ
// β divide(6, 4)
// β
6 / 4
Use Casesβ
Divide numbers πβ
Divide two numbers.
a / b;
Calculate ratioβ
Calculate proportions.
const ratio = part / total;
const percentage = (count / total) * 100;