Iterate Key using for in statement does not work.. help please

Tell us what’s happening:
Hi everyone,
I get stuck in the curriculum " Iterate Through the Keys of an Object with a for…in Statement"…
my code is below which is the same as the posted solution, but for some reason
I can’t pass… Can you please check what the error is?
Thank you.

Your code so far


function countOnline(usersObj) {
// change code below this line
let result = 0;
for (let user in obj) {
  if (obj[user].online === true) {
    result++;
  }
}
return result;
// change code above this line
}

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Safari/605.1.15.

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

Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement

You are attempting to iterate over obj, but there is no obj defined.

Thank you! I figured it out :slight_smile:

Congratulations! Happy coding.