Im stuck , please help

I’m really not getting why i don’t pass the lesson. Can you please help me understand what i’m doing wrong. Thank you so much

  **Your code so far**

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

var obj = {
gift: "pony",
pet: "kitten",
bed: "sleigh",
city: "Seattle"
};

var answer  = "Not found";

if (obj.hasOwnProperty(checkProp)) {
  answer = obj[checkProp];
} 
  
  return answer;

// Only change code above this line
}

console.log(checkObj("house"));




  **Your browser information:**

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36

Challenge: Testing Objects for Properties

Link to the challenge:

Hi @Maz-hub !

Welcome to the forum!

A few issues.

No.1:
This text is incorrect

Check proper capitalization.

No.2:
You are not supposed to create your own object.
Your function should work for ANY object.
Not just one you created yourself.

You can delete this.

3 Likes

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