Hi guys!
I have a problem with that challenge:
Instructions
Modify the function checkObj to test myObj for checkProp. If the property is found, return that property’s value. If not, return “Not Found”.
My code:
// Setup
var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh"
};
function checkObj(checkProp) {
// Your Code Here
var myObject = myObj.hasOwnProperty(checkProp);
if(myObject == true){
return checkProp;
}else{
return "Not Found!";}
}
// Test your code by modifying these values
checkObj("gift");
Everything is working right, but I’m not going forward. Can someone explain why it’s happening?
Link to the challenge:
https://www.freecodecamp.org/challenges/testing-objects-for-properties