When I try to run it without, then it refuses to pass any of it. Until I go back now and remove it and it works. This is getting kind of frustrating, when I originally tried it as just a if statement it bounced back, can you explain why that would me? I have had that happen a few times where something does not work, then it does.
Works for me with obj declared outside the function, which makes sense given it’s a param. Ran this in VSCode with node with no problemo:
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
}
obj = {
gift: "pony",
pet: "kitten",
bed: "sleigh",
city: "Seattle",
};
let result = checkObj(obj, "wombat");
console.log(result);