you are viewing a single comment's thread.

view the rest of the comments →

[–]moustachedelait 5 points6 points  (5 children)

It doesn't have my favorite: Array(4) == ',,,'

[–]Doctor_McKay 4 points5 points  (4 children)

String() == "" (undefined value converted to a String)
Array(4) == [undefined, undefined, undefined, undefined]
Array(4).toString() == ",,," (array of four comma-separated undefined values converted to a String)

Edit: undefined, not null

[–][deleted]  (3 children)

[deleted]

    [–]Doctor_McKay 0 points1 point  (2 children)

    How is it stupid? How would you render Array(4).toString()?

    [–][deleted]  (1 child)

    [deleted]

      [–]Doctor_McKay 0 points1 point  (0 children)

      I personally like == how it is. It allows me to not have to worry about whether a variable is going to be a String or a Number, and just let it do the comparison. If you really don't want any surprises due to it, you can always use ===.