The question asks to return true only if the object has all 4 mentioned properties.
And in hint section, the solution given as
function isEveryoneHere(obj) {
// change code below this line
if(users.hasOwnProperty('Alan','Jeff','Sarah','Ryan')) {
return true;
}
return false;
// change code above this line
}
This is wrong as the hasOwnProperty takes only 1 argument and ignores the rest. So it is just checking for Alan property and giving out the result based on if it is present in object or not.
The correct solutions are:
return ["Alan", "Jeff", "Sarah", "Ryan"].every(e =>
users.hasOwnProperty(e)
);
return (
users.hasOwnProperty("Alan") &&
users.hasOwnProperty("Jeff") &&
users.hasOwnProperty("Sarah") &&
users.hasOwnProperty("Ryan")
);
return (
"Alan" in users &&
"Jeff" in users &&
"Sarah" in users &&
"Ryan" in users
);
I hope this gets corrected it soon.