Testing Objects for Properties problem

Testing Objects for Properties problem
0

#1

I’m trying to Ouput the property value and it just outputs the property.

Here is what I have so far.

// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

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

// Test your code by modifying these values
checkObj("pet");

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0.

Link to the challenge:


#2

you need to use checkProp as an index value for myObj.
The following code is what you want
return myObj[checkProp];


#3

@michal9909 is right if you want the value of the property put it inside brackets like an array