Skip to content

Instantly share code, notes, and snippets.

@joegiralt
Created November 22, 2013 22:46
Show Gist options
  • Save joegiralt/7608201 to your computer and use it in GitHub Desktop.
Save joegiralt/7608201 to your computer and use it in GitHub Desktop.
Little JavaScript WTFs
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..?!?!?!?
@Vap0r1ze
Copy link

Vap0r1ze commented Mar 7, 2017

lol these all make sense if you look into how javascript is made

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment