Code is wrong, still passes, how? --- Check if an Object has a Property

Code is wrong, still passes, how? --- Check if an Object has a Property
0.0 0

#1

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

while(users.hasOwnProperty(“Alan”)){
return true;
}
return false;


#2

while checks whether some condition is true. What you’ve got is essentially the same as using if.


#3

But I checked for Alan only and not the other users, how is this test passing then?


#4

Ah, I see what you’re saying. Seems like the test could use some tweaking. Put up an issue and be a contributor!