Basic JavaScript: Testing Objects for Properties HELP

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

function checkObj(checkProp) {
// Your Code Here
if (myObj.hasOwnProperrty(checkProp) == true) {
return myObj[checkProp];
}
else {

return “Not Found”;
}

}
``
// Test your code by modifying these values
checkObj(“gift”);

myObj.hasOwnProperrty is not a function

Double r eighth line !!

It is hasOwnProperty, check for typos.

1 Like