Tuesday, May 24, 2011

JavaScript - Undefined Infinity or Not a Number?

Had a heated discussion with a friend about a particular expression and so this blog with ready references for some basic JavaScript expressions.

ExpressionValue
InfinityAnything beyond +/-1.7976931348623157e+308
typeof Infinity"number"
typeof NaN"number"
typeof undefined"undefined"
typeof null"object"
Infinity + InfinityInfinity
Infinity - InfinityNaN
-Infinity + InfinityNaN
Infinity / InfinityNaN
Infinity * InfinityInfinity
Infinity * 1Infinity
Infinity / 1Infinity
Infinity / 0Infinity
Infinity * 0NaN
Infinity - 1e308Infinity
Infinity - 1e309NaN
-Infinity + 1e308-Infinity
-Infinity + 1e309NaN
Infinity / 1e308Infinity
1 * "a"NaN
1 + NaNNaN
1 * NaNNaN
undefined + 1NaN
undefined * 1NaN
undefined + InfinityNaN
undefined * InfinityNaN
undefined + NaNNaN
undefined * NaNNaN
undefined + nullNaN
undefined * nullNaN
1 + null1
1 * null0
null + null0
null * null0
Infinity + nullInfinity
Infinity * nullNaN
NaN + nullNaN
NaN * nullNaN
"" + Infinity"Infinity"
"" + NaN"NaN"
"" + null"null"
"" + undefined"undefined"

Having fun yet ?

2 comments:

  1. Whats up are using Wordpress for your blog platform?
    I'm new to the blog world but I'm trying to get started and create my own.

    Do you require any coding expertise to make your own blog?
    Any help would be really appreciated!

    Also visit my homepage; youtube.com ()

    ReplyDelete
    Replies
    1. I just use the online editor provided by the G+ blogger.

      Delete