Checking if an Object has its own property issue

Tell us what’s happening:
Describe your issue in detail here.
So basically I was asked to make a function so when Alan, Jeff, Sarah, or Ryan is passed through isEveryoneHere() it should return true. I just wanted an explanation on why this didnt count as a pass. the question is from javascript algorithms and data structures basic data structures check if an object has a property

  **Your code so far**
      let users = {
  Alan: {
    age: 27,
    online: true
  },
  Jeff: {
    age: 32,
    online: true
  },
  Sarah: {
    age: 48,
    online: true
  },
  Ryan: {
    age: 19,
    online: true
  }
};

function isEveryoneHere(userObj) {
  if (users.hasOwnProperty(userObj)) {
    return true
  }
  return false
}

console.log(isEveryoneHere('Ryan'));

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

function isEveryoneHere(userObj) {
if (users.hasOwnProperty(userObj)) {
  return true
}
return false
}

console.log(isEveryoneHere('Ryan'));
  **Your browser information:**

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 14150.87.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.124 Safari/537.36

Challenge: Check if an Object has a Property

Link to the challenge:

first, the function is being passed in the object, userObj in this case is equal to users

you need to check that all four required properties, Alan , Jeff , Sarah and Ryan, are present in the object

also you never user users in your code, you instead need to always use userObj to access the object

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