Iterate Through the Keys of an Object with a Statement, help?

Tell us what’s happening:
The output I’m getting is perfectly fine. I was supposed find the count of number of users having true in online.
Still the it is not accepting the result.

Your code so far

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
  let count = 0;
  for (let key in obj) {
    for (let val in obj[key]) {
      if (val == "online") {
        count += obj[key][val] == true ?1:0;
  return count;
  // change code above this line


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36.

Link to the challenge:

I can’t debug at this time, but, instead of checking if val is that value, you know it must be that value, and that every object has that property, why don’t you do directly obj[key]["online"], removing that inner loop?

oh, the issue may be your ternary operator, try wrapping it in round parentheses