Tell us what’s happening:
Describe your issue in detail here.
**Your code so far**
function checkObj(obj, checkProp) {
// Only change code below this line
if obj.hasOwnProperty(checkProp){
return obj[checkProp]
}else{
return "Not Found"
};
// Only change code above this line
}
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36
The basic answer is that you are overwriting obj with hardcoded data within your function as opposed to testing the object that is passed to checkObj to see if it has the property checkProp
Looking at your code more carefully I think I see why you are struggling.
You have worked out the logic… making a few minor typos along the way. Then when it hasn’t worked you’ve tried to do more in the process undoing what you had in the first place!
So:
delete this:
obj={
gift:"Pony"
Pet:"Kitten"
Bed:"Sleigh"
}
Check this line for missing parenthesis AND a typo
function checkObj(obj, checkProp) {
// Only change code below this line
if obj.hasOwnProperty(checkProp){
return obj[checkProp]
}else if {
return "Not Found"
};
// Only change code above this line
}