For...in Statement help

Tell us what’s happening:
I need help devs!!
What are my mistakes ?
What is stil to edit my code so the function returns number?

My code so far


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

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:83.0) Gecko/20100101 Firefox/83.0.

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

Link to the challenge:

you do not have a variable named online, so online is undefined and so also usersObj[user][online]

How to define online in the code?

you don’t need an other variable - you should not use a variable there

I have replaced [online] with .online and I passed the challenge.
What is the meaning of that replacing?
My code so far:


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

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

dot notation will access the property of exactly that name, the equivalent in bracket notation is ["online"] as bracket notation evaluates what’s inside