function countOnline(usersObj) {
// Only change code below this line
for (let name in usersObj) {
let newarr = [];
if (name.online == true) {
newarr.push(name);
}
}
return newarr.length;
};
Although I see I have 'beaten about the bush' a little to get to the result. I don't understand why the code does not work.
This accessing gives you nothing useful.
You should change name.online to something relevant
Once you figure this all out, think about this: do you need array here to accumulate result? You need to get a number. You can use just simple variable to gather result.
Also, try to log out some stuff like:
console.log(Object.values(usersObj));
That should give you additional ideas how to play around objects.