Created
June 29, 2018 10:25
-
-
Save sedera-tax/cca30cedc2de0ca7b26c879d50e48666 to your computer and use it in GitHub Desktop.
Generate an Array of All Object Keys with Object.keys()
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
let users = { | |
Alan: { | |
age: 27, | |
online: false | |
}, | |
Jeff: { | |
age: 32, | |
online: true | |
}, | |
Sarah: { | |
age: 48, | |
online: false | |
}, | |
Ryan: { | |
age: 19, | |
online: true | |
} | |
}; | |
function getArrayOfUsers(obj) { | |
// change code below this line | |
return Object.keys(obj); | |
// change code above this line | |
} | |
console.log(getArrayOfUsers(users)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment