0 / 0 outputs NaN
while 1 / 0 outputs Infinity
How javascript evaluates the first mathematical operation?
As per spec
0 / 0 outputs NaN because
Division of a zero by a zero results in NaN; division of zero by any other finite value results in zero, with the sign determined by the rule already stated above.
and 1 / 0 outputs Infinity because
Division of a nonzero finite value by a zero results in a signed infinity. The sign is determined by the rule already stated above.
Point 7 and 8 in the section 12.6.3.2 Applying the / Operator (unordered list)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With