Can't access property of object

Tell us what’s happening:
The exercise as asking to count the number of users with an online property of true, but I’m having trouble accessing this property and I’m not sure where I’m going wrong. The user object looks like:

Alan: {
    online: false

So I tried


to access the online property, but it isn’t working. When I log the output of user[online] to
console, it’s printing out undefined, which confuses me. I tried capitalizing the O as well as iterating through the properties of the user object to see if that would help, but didn’t have any luck. Any information would be helpful. Thanks so much.

Your code so far

function countOnline(usersObj) {
// change code below this line
let online = 0;
for (let user in usersObj) {
  for (let prop in user) {
  if (user['online']) {

return online;
// change code above this line

Your browser information:

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

Challenge: Iterate Through the Keys of an Object with a for…in Statement

Link to the challenge:

Figured it out. Thought I was iterating through the objects, but I was just iterating through their keys. Should’ve read the lesson more closely.