I am copying this code from Basic Javascript topic “Testing Object from properties”. Problem is this that in example different code is showing and in example video different.
Though we cannot change code above the mention line which is totally neglected in the video example.
The video is there to help you understand the concepts. It is not intended that you will exactly duplicate the video character for character to solve the challenge.
OK got it but I am unable to figure out answer and when I check for hint everyone pasting same answer but I want answer related to example because I tried for half an hour myself but didn’t get answer.
// Only change code below this line
var obj = {
"gift" : "pony",
"pet" : "kitten",
"bed" : "sleigh"
};
if (obj.hasOwnProperty(checkProp)){
return obj[checkProp];
}
else{
return "Not Found"
}
// Only change code above this line
}
console.log(checkObj(gift));```
You will want to totally delete the definition of the object for the code you submit.
You will also need to remove the console log.
What I mean by the function signature is that you are calling checkObj("gift") but you should be calling checkObj(obj, "gift").
Really, you have a lot going on here that you don’t want. I’d reset the challenge and add only the lines of code that include the logic for checking for the property and returning the correct value.