Why this one is not working

let users = {
  Alan: {
    age: 27,
    online: true
  },
  Jeff: {
    age: 32,
    online: true
  },
  Sarah: {
    age: 48,
    online: true
  },
  Ryan: {
    age: 19,
    online: true
  }
};

function isEveryoneHere(obj) {
  // Only change code below this line
  let objItems = ['Alan', 'Jeff', 'Sarah', 'Ryan'];
  for(let i = 0; i < objItems.length; i++){
    console.log(objItems[i])
    if(!objItems[i] in obj) {
      return false;
    } else {
      return true;
    }
  }
  // Only change code above this line
}

console.log(isEveryoneHere(users));

you are checking only objItems[0]

1 Like

yeah shouldn’t it check all??

can you help me fixing it only with for and if??

it should, but the return stops the function when it is executed

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.