JS: Hard times checking objects

Hi guys, I’m having a hard time with this lesson: Basic JavaScript: Testing Objects for Properties.
My not working solution is:

function checkObj(obj, checkProp) {
  // Only change code below this line
  var obj = {
    gift: "pony",
    pet: "kitten",
    bed: "sleigh"
      };
   if (obj.hasOwnProperty(checkProp)) {
    return obj[checkObj];
  } else {
  return "Not Found"; 
  }
  // Only change code above this line
}
console.log(checkObj.hasOwnProperty("gift"));--> false
console.log(checkObj("gift")); --> Not Found

Anyone could help me, please?

Challenge: Testing Objects for Properties
Link to the challenge:

you have overwritten the obj parameter, making it impossible to check passed in objects

also,

you can’t call the function like that, it needs two parameters, an object and a string in that order

also, this is wrong because checkObj is the function name, you instead are checking for the checkProp parameter

I’m asking for a solution here :joy: I really don’t understand how to correct this in order to make it work

Problem Solved:

function checkObj(obj, checkProp) {
var obj = {
gift: “pony”,
pet: “kitten”,
bed: “sleigh”,
city: “Seattle”
}
if(obj.hasOwnProperty(checkProp)) {
return obj[checkProp];
} else {
return “Not Found”;
}
}


Thanks @ilenia :+1:t2:

delete this, as you are overwriting the function parameter making your function not reusable