Skip to content

Instantly share code, notes, and snippets.

@prettymuchbryce
Created August 23, 2014 17:35
Show Gist options
  • Save prettymuchbryce/a0afb3104b0137f63225 to your computer and use it in GitHub Desktop.
Save prettymuchbryce/a0afb3104b0137f63225 to your computer and use it in GitHub Desktop.
Javascript keys to strings
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