I am stuck on this.
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-data-structures/iterate-through-the-keys-of-an-object-with-a-for...in-statement
1 Like
Don’t show my code before you check it again:
- Use codepen.io or something to test it: what is your output? Why wrong?
- Next, console.log(something) to check code and know why wrong and fix it?
- See my code if you prepare to punch your laptop:
function countOnline(usersObj) {
// change code below this line
let count = 0
for (let value in usersObj) {
count = usersObj[value]['online'] ? count + 1 : count
}
return count
// change code above this line
}
maybe for next time instead of
you want to solve it
tell us
what have you tried
what is your code so far
what excatly is it that you find hard to understand
1 Like