Issue: checkObj({pet: "kitten", bed: "sleigh"}, "gift") should return the string Not Found

function checkObj(obj, checkProp) {
 // Only change code below this line

var checkObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh",
  city: "Seattle",
}
 if(checkObj.hasOwnProperty(checkProp)){
  return checkObj[checkProp];
} else {
return "Not Found";
 
 
 // Only change code above this line
}
}

You want to do the checks on the obj passed into the function, not on the checkObj you declared inside of the function. Remove the checkObj completely.

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

I got you. Thank you ma’am

Okay, I will
Thank you.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.