Iterate Through the Keys of an Object with a for...in Statement: example may be confusing

We have this example:

For our users object, this could look like:

for (let user in users) {
  console.log(user);
}

This would log Alan, Jeff, Sarah, and Ryan - each value on its own line.

And we have this example in code editor:

const users = {
  Alan: {
    online: false
  },
  Jeff: {
    online: true
  },
  Sarah: {
    online: false
  }
}

As you can see, there is no ‘Ryan’ in the code, though ‘Ryan’ is present in text description. Please, double check that.

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