Tell us what’s happening:
I am confused why my solution is not accepted when it works for all the test cases mentioned. I tried modifying the usersObj property values for each test case, and was able to get the answer they expected.
**Your code so far**
const users = {
Alan: {
online: false
},
Jeff: {
online: false
},
Sarah: {
online: false
}
}
function countOnline(usersObj) {
// Only change code below this line
let onlineCount=0;
for (let userKey in usersObj){
if(users[userKey].online===true){
onlineCount+=1;
}
}
return onlineCount;
// Only change code above this line
}
console.log(countOnline(users));
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36
Challenge: Iterate Through the Keys of an Object with a for…in Statement
Link to the challenge: