Tell us what’s happening:
So I think there is something wrong with the if statement I am using
Although I am getting no errors the code seems to completly ignore the if block
I tested it out somewhere else
My 1st idea was that it was a type error since it may not recognize the string? and skip over it. but, then most likely a type error would show
then i found that i had not used checkProp and replaced it
but now only half the test is incorect so for some reason whatever is in checkProp is not check over correctly
I added my previouse code and the error message i got as well to this post
checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "pet")
should return "kitten"
.
Passed
checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "house")
should return "Not Found"
.
let checkProp = "hello";
function checkObj(obj, checkProp) {
// Only change code below this line
if (checkObj.hasOwnProperty(checkProp)) ;
{
return "Not Found";
}
// Only change code above this line
}
Your code so far
function checkObj(obj, checkProp) {
// Only change code below this line
if (myObj.hasOwnProperty(checkProp)) ;
{
return "Not Found";
}
// Only change code above this line
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36
.
Challenge: Testing Objects for Properties
Link to the challenge: