Ternary Operators in Object Property - Not passing, Why?

Why will this code not pass the test? It works in the browser console.

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


Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:70.0) Gecko/20100101 Firefox/70.0.

Challenge: Check if an Object has a Property

Link to the challenge:

Because you are only checking if a single name appears and returning true or false instead of checking that all the names appear and returning true or false.

1 Like