Testing an object for properties. Error

In this challenge, I kept given error for :-

Error

checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "gift")

should return the string

pony

.

checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "pet")

should return the string

kitten

.

checkObj({city: "Seattle"}, "city")

should return the string

Seattle

.

Code*

let  myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh",
city: "Seattle"
};

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

checkObj("gift");


  **Your browser information:**

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

Challenge: Testing Objects for Properties

Link to the challenge:

reset your code and try again please, your function should have two parameters, not one


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 (’).

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