Created
April 30, 2017 12:19
-
-
Save kopylovvlad/13e1c36b5b905608deeed3e27315b482 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
groceryList = {} | |
groceryList['Bananas'] = 6 | |
groceryList['Apples'] = 12 | |
groceryList['Grapes'] = 2 | |
groceryList['Kiwis'] = 10 | |
groceryList['Pears'] = 8 | |
console.log(groceryList['Kiwis'] == 10) | |
console.log(Object.keys(groceryList).length == 5) | |
for key, val of groceryList | |
console.log("#{key} = #{val}") | |
delete groceryList['Apples'] | |
console.log(Object.keys(groceryList).length == 4) | |
values = [] | |
for key, val of groceryList | |
values.push(val) | |
console.log(values) | |
console.log(Object.keys(groceryList)) | |
for key of groceryList | |
delete groceryList[key] | |
console.log(Object.keys(groceryList).length == 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment