users object, this could look like:
for (let user in users) {In this statement, we defined a variable
console.log(user);
}
// logs:
Alan
Jeff
Sarah
Ryan
user, and as you can see, this variable was reset during each iteration to each of the object's keys as the statement looped through the object, resulting in each user's name being printed to the console.
NOTE:countOnline; use a for...in statement within this function to loop through the users in the users object and return the number of users whose online property is set to true.
users object contains users Jeff and Ryan with online set to true and users Alan and Sarah with online set to false
testString: assert(users.Alan.online === false && users.Jeff.online === true && users.Sarah.online === false && users.Ryan.online === true, 'The users object contains users Jeff and Ryan with online set to true and users Alan and Sarah with online set to false');
- text: The function countOnline returns the number of users with the online property set to true
testString: 'assert((function() { users.Harry = {online: true}; users.Sam = {online: true}; users.Carl = {online: true}; return countOnline(users) })() === 5, ''The function countOnline returns the number of users with the online property set to true'');'
```