Skip to content

Instantly share code, notes, and snippets.

@JackDanger
Created February 16, 2011 04:46
Show Gist options
  • Select an option

  • Save JackDanger/828885 to your computer and use it in GitHub Desktop.

Select an option

Save JackDanger/828885 to your computer and use it in GitHub Desktop.
gotcha.js
/* Arrays implicitly turn numbers to strings */
var total = 4
total += 5
// total: 9
total += [5]
// total: "95"
/* Arrays are numerically comparable */
1 > 0
// true
[1] > 0
// true
[9] > 8
// true
[4] < [5]
// true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment