Please help me understand what is happening here:
let users = {
Alan: {
age: 27,
online: false
},
Jeff: {
age: 32,
online: true
},
Sarah: {
age: 48,
online: false
},
Ryan: {
age: 19,
online: true
}
};
function countOnline(obj) {
// change code below this line
for (let usersOnline in obj) {
if (usersOnline[online] == true) {
return true;
}
}
return false;
// change code above this line
}
console.log(countOnline(users));
What I want to do here is return true if Alan, Jeff, Sarah, Ryan, 's online status is true.
But the results says that online is not defined. Why is that?