Tuesday, February 13, 2018

Infinity

This is gonna get you there:

console.log(13 / 0);

 
 

I'm serious! At the console you will see:

Infinity

 
 

Dividing by zero does not cause an exception! It gives you Infinity. Only if you divide zero by zero do you get NaN and otherwise you get Infinity. Well, unless you are diving a negative number. Then you will see this:

-Infinity

No comments:

Post a Comment