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

Tell us what’s happening:

Your code so far


function countOnline(usersObj) {
// change code below this line
let count = 0;

for(let user in usersObj)
{
    if(usersObj['user'].online === true)
        count++;
}

return count;
// change code above this line
}

console.log(countOnline(usersObj));

Your browser information:

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

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 should use user as a variable, to loop through the keys. Here you’re using "user" as a string, literally.

Thanks , I got it now.