Last active
December 10, 2015 00:19
-
-
Save azizshamim/4350784 to your computer and use it in GitHub Desktop.
Javascript funniness
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 foo = [] | |
undefined | |
> foo | |
[] | |
> foo['bar'] = 'baz' | |
'baz' | |
> foo | |
[ bar: 'baz' ] | |
> |
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 foo = new Array(); | |
undefined | |
> foo[0] = 'bar' | |
'bar' | |
> foo | |
[ 'bar' ] | |
> foo ['bar'] = 'baz' | |
'baz' | |
> foo['bar'] = 'baz' | |
'baz' | |
> foo | |
[ 'bar', bar: 'baz' ] | |
> JSON.stringify(foo) | |
'["bar"]' | |
> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment