Basic Data Structures - Generate an Array of All Object Keys with Object.keys()

Tell us what’s happening:
Describe your issue in detail here.

   **Your code so far**
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) {
 // Only change code below this line
return object.keys(obj);
 // Only change code above this line
}

console.log(getArrayOfUsers(users));
   **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36

Challenge: Basic Data Structures - Generate an Array of All Object Keys with Object.keys()

Link to the challenge:

There isn’t any [global] object called object, so trying to call the function keys here is you trying to run undefined.keys.

Look at what it’s asking you to write, it’s not the same as what you’ve written.

@timtoks Your problem is your return value does not contain the Object.keys(). It contains object.keys() which return undefined because object is not defined. You are missing the “O” of object.

1 Like

You did well with this. It’s just that when calling Object.keys(), the ‘o’ of object must be a capital ‘O’.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.