Last active
July 8, 2018 21:51
-
-
Save sevperez/8af626364c8d15effb5762e3cd339a20 to your computer and use it in GitHub Desktop.
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 products = { | |
"widget": 400, | |
"gear": 80, | |
"crank": 375, | |
"lever": 870, | |
}; | |
var otherProducts = Object.create(products); | |
otherProducts["wheel"] = 210; | |
var otherProductKeys = Object.keys(otherProducts); | |
console.log("otherProductKeys: ", otherProductKeys); | |
// logs otherProductKeys: [ "wheel" ] | |
for (var i = 0; i < otherProductKeys.length; i += 1) { | |
var key = otherProductKeys[i]; | |
console.log(key + " : " + otherProducts[key]); | |
} | |
// logs "wheel: 210" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment