I could not solve this

Tell us what’s happening:
I have tried many times figuring out the answer, and I have followed the hint. However, I still unable to pass the test. May I ask yours help, plzzzzzzzz

Your code so far

function countOnline(usersObj) {
// Only change code below this line
let result = 0;
for (let user in usersObj) {
  if (obj[user].online === true) {
return result;
// Only 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/84.0.4147.105 Safari/537.36.

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

Link to the challenge:

The conditional statement uses the wrong name of usersObj
if (obj[user].online === true)
You meant usersObj and not obj

1 Like