Check if an Object has a Property - Solutions under Hint

Tell us what’s happening:
I believe that my code is the correct solution and that 2 solutions provided under “Get a hint” (https://bit.ly/2NGDKxr) are wrong because hasOwnProperty takes into consideration only one (1st) argument (https://mzl.la/1oThQDR).

Your code so far


function isEveryoneHere(obj) {
  // change code below this line
  return ["Alan", "Jeff", "Sarah", "Ryan"].every(e => obj.hasOwnProperty(e));
  // change code above this line
}

Your browser information:

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

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-data-structures/check-if-an-object-has-a-property/

every() - mdn

it will only return a boolean value depending on whether or not all items in array satisfies the function

true means function is true for all items
false means its false for atleast 1 item

^The code is passing.

Anyway, you are right the hint is wrong. It has been fixed but the site has not been updated yet.

Exactly what is necessary for the assignment!

Excellent! Good to know :smiley: