Change:
This seed code can lead to a bit of confusion because the global variable name and parameter name are pretty similar What about isn't my favorite if someone has another idea. I just don't like when the type isn't strictly needed. No response All No response
can I work on this if anyone is not working?
This issue isn't ready for PRs yet
One idea for naming: -or -
I went with something other than because 1) that's the example 2) at least one learner has has said was a little hard to grok at first We could change the example (and maybe we should in light of 2?)
I can appreciate the idea behind it but I don't think the names should imply they are different things, and are not the same thing. Wouldn't just changing to for the parameter and leaving the object name as is work?
We can use that as the parameter name; I like it better than . This still doesn't fully handle the user complaint though. I see two problems 1) is a really awkward variable name. Swapping to fixes this. 2) Given the example, its an easy bug for users to write instead of the intended . Not sure if we want to address this or ignore this. Changing the global object name seems to be the best way to address this.
Maybe what really needs to be done is to change the example to something else, like maybe or something like that?
If we change the parameter we should change the example as well. Either to something unrelated and change the text as needed, or it would need to use as well. I think we are, in part, trying to fix the underlying issue of campers not fully understanding parameters and arguments. Which I'm not sure how or where to address. I think the code highlighter isn't helping either. Usually, const and arguments are colored differently from parameters and reassignable variables. As an example (I changed the loop to use const as well) !
Not sure how I feel about the parameter name but it might work.
I like the direction. How about Instructions Sometimes you need to iterate through all the keys within an object. You can use a </dfnloop to do this. The </dfnloop looks like: This code logs and , with each value on its own line. We defined the variable in the loop head and this variable was set to each of the object's keys on each iteration, resulting in each food's name being printed to the console. We've defined a function which accepts one argument, . Use a </dfnstatement inside this function to loop through the object and return the number of users whose online property is set to . An example of an object which could be passed to is shown below. Each user will have an property set to either or . Seed Code I think this way we use your better parameter name and we swap the example for something that doesn't lead the learner to the bug.
I think it looks good. As an aside, if we are documenting how works we should show how to access the properties on the object (in the example). I know we have taught how to use variables with objects and making them bridge the gap might force the learner to think about it more. But it feels a little wrong to me to teach without actually showing how to use it.
Small tweak for that: Instructions Sometimes you need to iterate through all the keys within an object. You can use a </dfnloop to do this. The </dfnloop looks like: This code logs and , with each key-value pair on its own line. We defined the variable in the loop head and this variable was set to each of the object's keys on each iteration, resulting in each food's name being printed to the console. We've defined a function which accepts one argument, . Use a </dfnstatement inside this function to loop through the object and return the number of users whose online property is set to . An example of an object which could be passed to is shown below. Each user will have an property set to either or . Seed Code

Discussion:
# --description-- <del> Sometimes you may need to iterate through all the keys within an object. This requires a specific syntax in JavaScript called a <dfn>for...in</dfn> statement. For our `users` object, this could look like: </del> <ins> Sometimes you need to iterate through all the keys within an object. You can use a <dfn>for...in</dfn> loop to do this. The for...in loop looks like: </ins> <del> ```js for (let user in users) { console.log(user); </del> <ins> ```javascript const refrigerator = { 'milk': 1, 'eggs': 12, }; for (const food in refrigerator) { console.log(food, refrigerator[food]); </ins> } ``` <del> This would log `Alan`, `Jeff`, and `Sarah` - each value on its own line. </del> <ins> This code logs `milk 1`  and `eggs 12`, with each key-value pair on its own line. </ins> <del> In this statement, we defined a variable `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. </del> <ins> We defined the variable `food` in the loop head and this variable was set to each of the object's keys on each iteration, resulting in each food's name being printed to the console. </ins> **NOTE:** Objects do not maintain an ordering to stored keys like arrays do; thus a key's position on an object, or the relative order in which it appears, is irrelevant when referencing or accessing that key. # --instructions-- <del> We've defined a function `countOnline` which accepts one argument (a users object). Use a <dfn>for...in</dfn> statement within this function to loop through the users object passed into the function and return the number of users whose `online` property is set to `true`. An example of a users object which could be passed to `countOnline` is shown below. Each user will have an `online` property with either a `true` or `false` value. </del> <ins> We've defined a function `countOnline` which accepts one argument, `allUsers`. Use a <dfn>for...in</dfn> statement inside this function to loop through the `allUsers` object and return the number of users whose online property is set to `true`. An example of an object which could be passed to `countOnline` is shown below. Each user will have an `online` property set to either `true` or `false`. </ins> ```js {

} } <del> function countOnline(usersObj) { </del> <ins> function countOnline(allUsers) { </ins> // Only change code below this line // Only change code above this line

# --solutions-- ```js <del> function countOnline(usersObj) { let online = 0; for(let user in usersObj){ if(usersObj[user].online) { online++; </del> <ins> function countOnline(allUsers) { let numOnline = 0; for(const user in allUsers){ if(allUsers[user].online) { numOnline++; </ins> } } <del> return online; </del> <ins> return numOnline; </ins> } ```