Hint Button Not Working: Iterate Through the Keys of an Object with a for...in Statement

<%= @topic_view.topic.title %>
<%= @topic_view.topic.average_rating %> <%= @topic_view.topic.posts.count { |p| !!p.custom_fields['rating'] } %>

The “Get a Hint” button on the JavasScript challenge does not seem to work.
It links to https://guide.freecodecamp.org/certifications/javascript-algorithms-and-data-structures/basic-data-structures/-iterate-through-the-keys-of-an-object-with-a-for---in-statement

while the real hint page is at:

Difference is at the “…” at the end of the URL.

Bonus points if someone can tell me why the dot notation doesn’t work in this example?
The below code works just fine:

let myOnline=0;
  for (let isOnline in obj) {
    if (obj[isOnline]['online']) {  
      myOnline++;
    }
  }

But using the below on line 3 doesn’t work:
obj.isOnline['online']

Thanks!

the object doesn’t have a property called isOnline, so dot notation doesn’t work

1 Like