I need a solution to the last problem.
I have goten all the answers right, except the last one = checkObj({pet: “kitten”, bed: “sleigh”}, “gift”) should return the string Not Found.
**Your code so far**
function checkObj(obj, checkProp) {
// Only change code below this line
var obj =({gift: "pony",pet: "kitten",bed: "sleigh",city:"Seattle" } );
if(obj.hasOwnProperty(checkProp)){
return obj[checkProp];
}
else
return "Not Found";
// Only change code above this line
}
The solution is right and wrong at the same time .
For one, you must not change/reassign the obj variable inside your function, otherwise you’re cheating . The tests to check that your project works will test the function and pass their own obj.