Such values as Infinity
and
-Infinity
are obtained if some number
is divided by zero. JavaScript does not
throw an error, in such a case, as in other
programming languages, but returns these values:
alert( 1 / 0); // shows Infinity
alert(-1 / 0); // shows -Infinity
Divide the number 10
by 0
.
Display the result on the screen.
Divide the number -10
by 0
.
Display the result on the screen.