Generate an Array of All Object Keys with Object.keys() 1

Generate an Array of All Object Keys with Object.keys() 1
0

#1

Tell us what’s happening:
j
don’t get it

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) {
  // change code below this line

  // 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/67.0.3396.87 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-data-structures/generate-an-array-of-all-object-keys-with-object-keys


#2

Basically the solution is given for you in the instructions where it says,

Object.keys()

You will want to return keys of any object (object parameter) that is passed within the function.

return Object.keys(obj);


#3

HI I am still having problem with my code with the example you gave @shimphillip it states that object is undefined. What am I doing wrong cause I write return object.keys(obj); but object is said to be undefined.


#4

It’s capital O in object.