Handlebar Helper Function: Divide
Divides two numeric arguments and returns their quotient. The function can handle both integers and floating-point numbers, and attempts to convert strings to numbers.
| Parameter | Type | Description |
|---|---|---|
dividend | number or string | Required. The number to be divided. Must be a number or convertible to a number. |
divisor | number or string | Required. The number to divide by. Must be a number or convertible to a number, and not 0. |
The function returns the arithmetic quotient of the two input values. If you provide more than two arguments, the operation divides only the first two. The result is always a number rounded to 2 decimal places. If you divide by 0, the operation throws an exception.
If either input is a string, the operation tries to convert it to a number. If a string value can't be converted to a number, the operation throws an exception. Division by zero throws an exception.