Last active
August 10, 2016 15:07
-
-
Save dpedro/274d6b4c5ed01004b734710e6958077e to your computer and use it in GitHub Desktop.
Object by key, value
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 users = {} | |
users = { | |
"john": { id: 'john01', role: 'admin' }, | |
"bob": { id: 'bob01', role: 'reader' }, | |
} | |
users["steeve"] = { id: 'steeve01', role: 'admin' }; | |
console.log(users); | |
console.log(users['bob']); | |
console.log(Object.keys(users).length) | |
Object.keys(users).map(function(user, index) { | |
console.log(user); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment