Basic Data Structures - Check if an Object has a Property

Tell us what’s happening:
can someone please show me what i am doing wrong

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) {
  // Only change code below this line
 return userObj.hasOwnProperty('Alan', 'Jeff', 'Sarah', 'Ryan') ? true : false
  
  // Only change code above this line
}

console.log(isEveryoneHere(users));

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36

Challenge: Basic Data Structures - Check if an Object has a Property

Link to the challenge:

The hasOwnProperty method only takes one single string argument (or technically it could also be a Symbol). So you can’t pass in multiple strings like that.

1 Like

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