Iterate Through the Keys of an Object with a Statement

what is the mistake ,running tests error

const users = { Alan: { online: true }, Jeff: { online: true }, Sarah: { online: false } }

function countOnline(usersObj) {
// Only change code below this line
let count=0;
for (let usersObj in users) {
if(users[usersObj][‘online’]) {
return count;
// Only change code above this line

Please post a link to the challenge website.

The syntax of your loop is wrong.

let object = {1: "a", 2: "b"};
for (let key in object) {

You also try to declare usersObj as the variable in your loop, but it’s already the object you pass into the function. Instead you use the global object users

Nice explanation, I typed about the same a minute later lol.

The more different explanations, the higher the chance that it will be understood - no need to delete it :wink: