EDIT
I solved the problem; it was a missing bracket
Tell us what’s happening:
Hey all, I’ve been trying to complete this challenge. The code provided in the “Get a Hint” section doesn’t work. I failed the requirement: " The function countOnline
should use a for in
statement to iterate through the object keys of the object passed to it."
Thanks in advance.
Your code so far
function countOnline(usersObj) {
// Only change code below this line
let result = 0;
for (let user in usersObj)
if (usersObj[user].online === true) {
result++;
}
return result;
// Only change code above this line
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36
.
Challenge: Iterate Through the Keys of an Object with a for…in Statement
Link to the challenge: