Testing Objects for Properties challenge

Tell us what’s happening:

I keep trying to solve this challenge but it is not working. here is my code

Your code so far

function checkObj(obj, checkProp) {
var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh"
function checkObj(checkProp) {
if (myObj.hasOwnProperty(checkProp)){
return myObj[checkProp];
return "Not Found";

Your browser information:

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

Challenge: Testing Objects for Properties

Link to the challenge:

you have defined again the function, but the function is already defined as

function checkObj(obj, checkProp) {
   // your code here

you shouldn’t defined the myObj object, and you should use both parameters, obj and checkProp

1 Like