Why don't i go through this one? Everything is ok in this code

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.

1 Like

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) {
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) {

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. :grinning:

You can format your code in the fcc editor by right clicking and choosing the format option.
Screen Shot 2021-06-09 at 8.46.03 PM

Hope that helps!

1 Like

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