The division operator (Documentation Index
Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
Use this file to discover all available pages before exploring further.
/) is a binary arithmetic operator that calculates the quotient of its left operand (dividend) divided by its right operand (divisor). For standard numbers, which are implemented as double-precision 64-bit floating-point values (IEEE 754), the division operator yields a floating-point result, retaining fractional components rather than implicitly truncating to an integer.
Type Coercion
If either operand is not of typeNumber or BigInt, JavaScript evaluates the expression by implicitly coercing the operands using the abstract ToNumeric operation. The distinction of using ToNumeric rather than ToNumber is critical because ToNumeric allows object wrappers of BigInts (e.g., Object(5n)) to be correctly unboxed to BigInt primitives rather than being forced into Number types. If an operand cannot be successfully coerced into a valid numeric value, the operation evaluates to NaN.
Floating-Point Exceptions and Special Values
For standardNumber types, JavaScript does not throw a runtime exception for division by zero. Instead, it adheres to IEEE 754 specifications for special numeric values:
- Division by Zero: Dividing a non-zero positive number by
0yieldsInfinity. Dividing a non-zero negative number by0yields-Infinity. - Zero by Zero: Dividing
0by0yieldsNaN. - Infinity: Dividing any finite number by
Infinityor-Infinityyields0or-0. DividingInfinitybyInfinityyieldsNaN.
BigInt Evaluation
When both operands areBigInt primitives, the / operator performs integer division. The result is always truncated towards zero, discarding any fractional remainder.
Unlike standard Number evaluation, dividing a BigInt by 0n explicitly throws a RangeError.
BigInt and Number types across the / operator without explicit casting will throw a TypeError, as JavaScript does not implicitly coerce between these two distinct numeric types.
Master JavaScript with Deep Grasping Methodology!Learn More





