Skip to content

Instantly share code, notes, and snippets.

@rjfranco
Last active February 26, 2019 21:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rjfranco/6717368 to your computer and use it in GitHub Desktop.
Save rjfranco/6717368 to your computer and use it in GitHub Desktop.
Javascript is Wierd.
[] + []
// returns an empty string, ''
[] + [0]
// returns a string, '0'
[0] + [0]
// returns a string, '00'
[0,0] + [0]
// returns a string, '00,0'
[] + {}
// returns either a string of '[obejct Object]', or [object Object]
{} + []
// returns 0
{} + {};
// returns NaN ( Not a number. )
++[[]][+[]]+[+[]];
// Returns string '10'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment