Testing Objects for Properties -How do we do this?

Tell us what’s happening:
I think I am supposed to use an if /else statement to fix this but the logic doesn’t make sense to me.

Your code so far

// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here
if myObj.checkObj(checkProp) return "";    // true
myObj.checkObj();  
  return "Change Me!";
}

// Test your code by modifying these values
checkObj("gift");//

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36.

Link to the challenge:
https://www.freecodecamp.org/challenges/testing-objects-for-properties

https://www.freecodecamp.org/challenges/testing-objects-for-properties

return “Not Found” doesn’t work. Can you tell me what’s wrong with my code?

var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here
  myObj.hasOwnProperty(checkProp);
  if (checkProp) 
    return myObj[checkProp];
  else 
    return "Not Found";
}

// Test your code by modifying these values
checkObj("house");

Got it. Thanks for your help. I’ll make use of the back ticks next time for posting my code.

Tell us what’s happening:
Please, could someone help me figure this out?!

I found this a bit challenging and but after playing around I got the code below - which gave me an error for the last test (checkObj(“house”) should return “Not Found”).

I went onto the forum for some much-appreciated guidance and found someone had created this solution which worked, but for the life of me I can’t see the error or difference in my code. I also added “return “Change Me!”;” but the last test did not work:

function checkObj(checkProp) {
// Your Code Here
if (myObj.hasOwnProperty(checkProp)) {
return myObj[checkProp];
} else {
return “Not Found”;
}

return “Change Me!”;
}

Your code so far

// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  // Your Code Here
  if (myObj.hasOwnProperty(checkProp)) {
    return myObj[checkProp];
  } else {
    return "Not found";
  }
}

// Test your code by modifying these values
checkObj("gift");

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36.

Link to the challenge: