Created
August 5, 2016 12:53
-
-
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".
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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