Tell us what’s happening:
Describe your issue in detail here.
**Your code so far**
function checkObj(myObj, checkProp) {
// Only change code below this line
var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh"
};
if (myObj.hasOwnProperty(checkProp)) {
return obj[checkProp];
} else {
return "Not Found";
}
}
checkObj("gift");
// Only change code above this line
**Your browser information:**
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.109 Safari/537.36
The parameter myObj is not the same identifier as obj you are using both. You should be using the myObj parameter which is what gets the object passed to it.
You can’t use a parameter outside the function, it is scoped to the function. A parameter is just a local variable that you can pass values to using arguments when calling the function.
// firstName is the parameter
function logName(firstName) {
console.log(firstName); // John
}
// 'John' is the argument
logName('John');
console.log(firstName); // reference error
If you wanted to use the value inside a parameter outside the function you have to either assign it to an outer scoped variable or return it out of the function. None of which is relevant to this challenge.
Remove the object you added
Change obj to myObj for the return on the line I showed.