Basic Data Structures # 17: Check if an Object has a Property

Hi Hi, I know there are multiple ways to accomplish things sometimes, so here’s what I came up with also for this lesson. It seems to work fine when I alter the values, but the lesson is looking for something else in it. The lesson seems a little vague or perhaps they just want to see which way you can come up with to solve it. Honestly, I wasn’t too sure if it was expecting me to take the input one at a time, or all at once, like in an array. So I guess I was looking at both.
After looking around I would have never considered the .event method.

Here is a link to it for reference:

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
  let attenList = ["Alan", "Jeff", "Sarah", "Ryan"]; // Presumed input was an array
  let count = 0;

  for (let i = 0; i < attenList.length; i ++) {
    if (users.hasOwnProperty(attenList[i])) {
      //console.log(attenList[i]);  Just a check to see if this part was working
      count ++;
    } else {
      return "false";
  return "true";
  // change code above this line


this is supposition, if you also share the link to the challenge you are working on it is much easier to help you

I think you are returning a string, but you are asked to return a boolean

Hi there, I edited my original post a little for more clarity. Hope this helps.

Snap!! Haha, Ok, I just figured out what was going on.
I had quoted “” the true/false return and didn’t need to.
Is all running normal now.