Created
December 17, 2013 00:21
-
-
Save meandavejustice/7997704 to your computer and use it in GitHub Desktop.
create arr, add an attribute with dot notation. wat?
This file contains 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 arr = [] | |
undefined | |
> arr | |
[] | |
> arr.keyName = true | |
true | |
> arr | |
[ keyName: true ] | |
> arr[0] | |
undefined | |
> arr.keyName | |
true | |
> |
Arrays are just special Object/Hash's. typeof arr
holds the truth.
@jden I understand why it works... I was just having trouble understanding a use case.
I use it, eg, for paged collections. JavaScript collections, especially <ES6, are fairly assumption-rich and feature-poor compared to other languages, imo.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
which line in particular is confusing or unexpected?