Your logic and approach to the problem are spot on, but you are not using the hasOwnProperty correctly.
The syntax should look like --> // myObj.hasOwnProperty(“property you wish to check” ) //
Your conditional is asking whether there is a property nested on a property called "checkProp"
which would look like
var myObj={
hasOwnProperty:{checkProp:“Some Value…” }
}
I hope this was at all helpful, glad to help further if nothing I said was too clear. The instructions to the problem show how to use the the method correctly as well.
That challenge only requires that you return true or false, so you can just do:
return myObj.hasOwnProperty(checkProp);
But, if you want to access the property’s value like your code tries to do, you need to use the bracket notation when accessing the object via a variable, e.g.:
The challenge wants you to return a boolean (true/false), so you can just check it with the hasOwnProperty() function, as shown below. I only mentioned the brackets for general reference if you want to access a property when using a variable for the property name.
function checkObj(checkProp) {
return myObj.hasOwnProperty(checkProp);
}