Skip to content

Instantly share code, notes, and snippets.

@sedera-tax
Created June 29, 2018 10:25
Show Gist options
  • Save sedera-tax/cca30cedc2de0ca7b26c879d50e48666 to your computer and use it in GitHub Desktop.
Save sedera-tax/cca30cedc2de0ca7b26c879d50e48666 to your computer and use it in GitHub Desktop.
Generate an Array of All Object Keys with Object.keys()
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