1var dogs = {
2 Fido: "Mutt", Hunter: "Doberman", Snoopie: "Beagle"
3};
4var myDog = "Hunter";
5var myBreed = dogs[myDog];
6console.log(myBreed); // "Doberman"
1var someObj = {
2 propName: "John"
3};
4function propPrefix(str) {
5 var s = "prop";
6 return s + str;
7}
8var someProp = propPrefix("Name"); // someProp now holds the value 'propName'
9console.log(someObj[someProp]); // "John"