Created
November 22, 2013 22:46
-
-
Save joegiralt/7608201 to your computer and use it in GitHub Desktop.
Little JavaScript WTFs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a = [20, 10, 5, 1]; | |
// Everyday array | |
a.sort(); | |
// [1, 10, 20, 5]... WTF? | |
a == [1, 10, 20, 5]; | |
// false | |
a === [1, 10, 20, 5]; | |
// also false | |
[,,,].join() // ==> ",," | |
// Wtf? | |
alert(typeof NaN); //alerts 'Number' WTF NaN is a number???? | |
alert(NaN === NaN); //evaluates false WTF NaN is Not equal to its self..?!?!?!? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
lol these all make sense if you look into how javascript is made