Created
April 30, 2017 12:16
-
-
Save kopylovvlad/4b68dbea4d1356b25ae7165ed7545549 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'] = true | |
| groceryList['Apples'] = true | |
| groceryList['Grapes'] = true | |
| groceryList['Kiwis'] = true | |
| groceryList['Pears'] = true | |
| groceryList['Apples'] = true # dublicates will be ignored | |
| console.log(Object.keys(groceryList).length == 5) | |
| console.log(groceryList['Kiwis'] == true) | |
| for key of groceryList | |
| console.log(key) if groceryList.hasOwnProperty(key) | |
| console.log(Object.keys(groceryList).length == 5) | |
| delete groceryList['Kiwis'] | |
| console.log(Object.keys(groceryList).length == 4) | |
| 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