Someone to help me... They are telling me this:

//setup

var myObj = {

  gift: "pony",

  pet: "kitten",

  bed: "sleigh"

};

function checkObj(checkProp) {

  // Your Code Here

  myObj.hasOwnProperty(checkProp);

  return myObj[checkProp] || "Not Found";

  }

  // Test your code by modifying these values

  checkObj("house");

And they are telling me this:

// running tests

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

. // tests completed

Please provide a link to the challenge. We haven’t memorized all tasks.

Turn that into

console.log( checkObj("house") )

Then see what it returns.
Also look at the object - it doesn’t have a “house” property.

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

hasOwnProperty() returns a value, but you aren’t currently using that value, so this line effectively doesn’t do anything.

It looks like you changed the function signature, possibly by copy-pasting some old answer you found somewhere for a previous version of this challenge. I strongly recommend against doing this. It hurts your learning and often you get wrong answers.

1 Like