users is an object, which has as properties “Jeff”, “Sarah”, etc - so your condition can never be true
but, other than that, consider that once the code meet a return statement, the function returns that value and stop executing, so even if you had code to check the inner objects, you would just be checking the first one - plus, you don’t need to check if they have the property, but if their online property is set to true
and then return a number that count how many are online, not a boolean
this is what my function looks like, my understanding is that we are using obj to represent each individual property with the object users but it seems to always return false and not return all the objects that is true i tried t also use filer method, i guess i still have an issue with my thought logic process.
function countOnline(obj) {
// change code below this line
for(obj in users) {
// if the online property === true display the value
if(obj === true){
return obj;
//console.log(obj);
} return false;
// change code above this line
}
}
console.log(countOnline(users));
this is now how i have rebuilt my function however i get the messages:
** Cannot read property ‘online’ of undefined** Cannot read property ‘online’ of undefined
// change code below this line
for(let user in obj) {
//console.log(users[obj]);
// if the online property === true output the value
if([obj].user.online === true){
return [obj].user.online;
//console.log(obj);
} return false;
// change code above this line
}
}
console.log(countOnline(users)); ```