Created
August 23, 2014 17:35
-
-
Save prettymuchbryce/a0afb3104b0137f63225 to your computer and use it in GitHub Desktop.
Javascript keys to strings
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 myDictionary = {}; | |
var myKey = 1; | |
myDictionary[myKey] = 'someValue'; | |
console.log(typeof myKey); | |
for (var i in myDictionary) { | |
console.log(typeof i); | |
} | |
console.log(myDictionary[1]); | |
myDictionary["1"] = 'someNewValue'; | |
console.log(myDictionary[1]); | |
//derp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment