Javascript weirdest features

  1. typeof Array returns ‘object’
  2. typeof null returns ‘object’
  3. var n = [4, 8, 15, 16, 23, 42];
    n.sort( ); // n is [15, 16, 23, 4, 42, 8]
  4. parseInt(“08”) = 0, because js thinks that the number has base 8.
  5. 0.1 + 0.2 is not equal to 0.3
  6. typeof NaN == = ‘number’ // true
    NaN === NaN // false
    NaN !== NaN // true
  7. ‘ ‘ == ‘0’ // false
    0 == ‘ ‘ // true
    false == ‘false’ // false
    false == ‘0’ // true
    false == undefined // false
    false == null // false
    null == undefined // true’ \t\r\n ‘ == 0 // true
Advertisements
This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s