Please fix my mistakes if i did it
If you have a question about a specific challenge as it relates to your written code for that challenge, just click the Ask for Help button located on the challenge. It will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.
Thank you.
Tell us what’s happening:
Describe your issue in detail here.
**Your code so far**
function countOnline(usersObj) {
// Only change code below this line
let result = 0
for (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/91.0.4472.77 Safari/537.36
Challenge: Iterate Through the Keys of an Object with a for…in Statement
Link to the challenge:
Hi @lankoni !
The issue is here
You need to define the variable of user.
Here is the fcc example again.
for (let user in users) {
console.log(user);
}
Once you make that small change then the test will pass.
Also, as a side note, I would advise you to format your code.
When you start writing longer pieces of code it will help you find errors if your code is properly formatted. ![]()
You can format your code in the fcc editor by right clicking and choosing the format option.

Hope that helps!
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
