Basic Data Structures - Iterate Through the Keys of an Object with a Statement

Tell us what’s happening:
Describe your issue in detail here.
Is this coding challenge broken? I was having a hard time, so I tried the solution available from freeCodeCamp and it still returned with failed tests. But if I changed the data in the object key values the data the tests were testing for would be correct.
Your code so far

const users = {
  Alan: {
    online: false
  Jeff: {
    online: true
  Sarah: {
    online: false

function countOnline(allUsers) {
  // Only change code below this line
let count = 0;
for (let prop in users) {
 if (users[prop].online === true) {
  // Only change code above this line
return count;

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

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

Link to the challenge:

It looks like you copied the answer incorrectly. I wouldn’t do that. (Copy the answer at all, let alone incorrectly)

Your function needs to totally ignore the global variable.

I try not to until I’m at a total loss. Thanks for the help!

1 Like

It can get frustrating for sure. Luckily, those of us on the forum have made thousands of mistakes, so we can usually spot what the mistake is pretty quickly.