Skip to content

Instantly share code, notes, and snippets.

@amithld
Created August 5, 2016 12:53
Show Gist options
  • Save amithld/010493105571c17f8c12e74804fe85d0 to your computer and use it in GitHub Desktop.
Save amithld/010493105571c17f8c12e74804fe85d0 to your computer and use it in GitHub Desktop.
what is wrong with the code? :- Modify the function checkObj to test myObj for checkProp. If the property is found, return that property's value. If not, return "Not Found".
var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh"
};
function checkObj(checkProp) {
// Your Code Here
if(myObj.hasOwnProperty("checkProp"))
{
return myObj.checkProp;
}else
return "Not Found";
}
// Test your code by modifying these values
checkObj("gift");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment