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) {
count++;
}
// Only change code above this line
}
return count;
}
console.log(countOnline(users));
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36
Challenge: Basic Data Structures - Iterate Through the Keys of an Object with a for…in Statement
Link to the challenge: