Infinity in Javascript

Posted in Articles

Tweet This Share on Facebook Bookmark on Delicious Digg this Submit to Reddit

Javascript has a number type called “Infinity”. If you run “typeof” on Infinity, you get Number…

typeof Infinity in Javascript

typeof Infinity in Javascript

Infinity can be compared to itself and it returns true.   Infinity is obtained by taking a number and dividing by 0.  This obeys the rules of math.

Hence …

4 / 0 == Infinity

is true.