Tell us what’s happening:
I already passed the test using ‘in’ keyword instead, but I just wanted to make sure that it is not a bug in the website and I did it right. Thank You.
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) {
// change code below this line
if ('Alan', 'Jeff', 'Sarah', 'Ryan' in users ){
return true;
}
return false;
// change code above this line
}
console.log(isEveryoneHere(users));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 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
Hey @AndrewAlkazeer,
You are not using the arguments inside your function anywhere in your code.
Think about where you will fit in it and then try solving.
Hope that helps.
1 Like
In addition to what @aditya_p said (which involves changing just one specific thing in your code), this:
if ('Alan', 'Jeff', 'Sarah', 'Ryan' in users )
Is not valid syntax and will cause an error. a in y && b in y && c in y
not a, b, c in y
1 Like
I fixed it, it worked now. Thank You
function isEveryoneHere(obj) {
// change code below this line
if (obj in users ){
return true;
}
return false;
// change code above this line
}
console.log(isEveryoneHere('Jeff'));
Sure. Here we go:
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
if (obj in users ){
return true;
}
return false;
// change code above this line
}
console.log(isEveryoneHere('Jeff'));
You are right! I tried it too now and it did not pass the second test either, I do not know how I passed then, but if you check repl.it it will work
Here is the link on repl.it : https://repl.it/@AndrewAlkazeer/AuthenticCrispWearables-28