Check if Object has a Property

Why this code (my code) is incorrect?

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(obj) {
// Only change code below this line
if('Alan' in obj && 'Jeff' in obj && 'Sarah' in obj &&'Rayan' in obj)

{ return true;
}
else{ return false;}
// Only change code above this line
}

console.log(isEveryoneHere(users));

Your browser information:

Challenge: Check if an Object has a Property

Link to the challenge:

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

Hi,

You have a typo Ryan Not Rayan.

1 Like

Ah, got it. Thank you!

Edit: haha typed to slow. you already got it :laughing:
This is not how you spell ryan

Thank you!! Next time I will do. This is my first time to post a question.

1 Like

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