# Generate an Array of All Object Keys with Object.keys() - help

**URL:** <https://forum.freecodecamp.org/t/generate-an-array-of-all-object-keys-with-object-keys-help/222251>\
**Category:** Curriculum Help\
**Tags:** javascript\
**Created:** [August 29, 2018, 5:29pm UTC](https://forum.freecodecamp.org/t/generate-an-array-of-all-object-keys-with-object-keys-help/222251 "2018-08-29T17:29:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidsolagui](https://avatars.discourse-cdn.com/v4/letter/d/50afbb/32.png) [@davidsolagui](https://forum.freecodecamp.org/u/davidsolagui)\
**Post date:** [August 29, 2018, 5:29pm UTC](https://forum.freecodecamp.org/t/generate-an-array-of-all-object-keys-with-object-keys-help/222251/1 "2018-08-29T17:29:04Z")

</div>

**Tell us what’s happening:**

Dont understand how to get all what is inside. something is missing and dont understand what

**Your code so far**

```js

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

Object.keys(obj);

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

**Link to the challenge:**

> **[freeCodeCamp.org](https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-data-structures/generate-an-array-of-all-object-keys-with-object-keys)**
>
> Learn to Code — For Free

---

<div class="post-metadata">

**Author:** ![snntaylan](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/snntaylan/32/67149_2.png) [@snntaylan](https://forum.freecodecamp.org/u/snntaylan)\
**Post date:** [September 19, 2018, 10:36am UTC](https://forum.freecodecamp.org/t/generate-an-array-of-all-object-keys-with-object-keys-help/222251/3 "2018-09-19T10:36:31Z")

</div>

In blow, I pass the test. Bu I could not understand this part of Object.keys(). I read the instructions. I need return an array. But why is this correct ?

```auto
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(users);
  // change code above this line
}

console.log(getArrayOfUsers(users));

```

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [February 2, 2021, 11:30am UTC](https://forum.freecodecamp.org/t/generate-an-array-of-all-object-keys-with-object-keys-help/222251/5 "2021-02-02T11:30:06Z")

</div>


