I dint think i've made any mistakes here...still the code doesn't run in the terminal

Tell us what’s happening:

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
  var count = 0;
  for(let user in obj){
    if(user["online"] != false){
      count = count+1;
    }
  }
  return count;

  // change code above this line
}

console.log(countOnline(users));

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-data-structures/-iterate-through-the-keys-of-an-object-with-a-for---in-statement

Out of interest, why do you type != false, as apposed to == true?

The problem is this line:

 if(user["online"] != false)

before != false

The for...in statement iterates over all non-[Symbol] enumerable properties of an object.

let user in obj 
``` // the user is not an object, it is the property inside(of) users object.
    // try users[user].online or users[user]["online"] instead of user["online"]