Solution doesn't work

In the JavaScript Data Structures curriculum, I am on the following lesson:

Basic Data Structures: Iterate Through the Keys of an Object with a for…in Statement

My solution matches the one in the guide, and yet it is not being accepted. The code is as follows:

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

The output console displays the following:

// running tests
The function countOnline should return 1 when the object { Alan: { online: false }, Jeff: { online: true }, Sarah: { online: false } } is passed to it
The function countOnline should return 2 when the object { Alan: { online: true }, Jeff: { online: false }, Sarah: { online: true } } is passed to it
The function countOnline should return 0 when the object { Alan: { online: false }, Jeff: { online: false }, Sarah: { online: false } } is passed to it
// tests completed

Does anyone know what the problem is? Thank you in advance.

Challenge link: 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

Solution guide link: freeCodeCamp Challenge Guide: Iterate Through the Keys of an Object with a for...in Statement

*Edited to add links.

Hi and welcome to the forum.

Please provide a link to the challenge and the guide post so we can help you troubleshoot.

Hi and thank you. I have edited the original post to add the links to the challenge and solution guide.

Your function argument is named usersObj and you’re iterating over userObj in your for...in loop.

Wow, I can’t believe I didn’t notice that typo, that’s embarrassing. :weary: Thank you for your help! :smiley: