Help with Data Structures: Iterate Through the Keys of an Object with a for...in Statement

I can’t figure out what I’m doing wrong with this block of code. Reading other solutions on the forum, I feel I’m solving this challenge properly, but it just won’t pass. Not sure If I’m misspelling something or if there’s any other errors. Just looking for a solution, thanks!

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

1 Like

Welcome, tazman.

First thing to hint at the solution:

function countOnline(usersObj) {

Your function has the usersObj parameter, yet you do not use it…

Hope this helps

2 Likes

Thanks! Apparently had a brain fart.