I have this code...
var suitcase = {
shirt: "Hawaiian"
};
var checkProp = function(obj, prop, val){
if(obj.hasOwnProperty(prop)){
console.log(obj.prop);
} else {
obj.prop = val;
console.log(obj.prop);
}
};
checkProp("suitcase","shorts","blue");
and when I run it, it returns undefined. On the surface it looks fine. No syntax problems or similar things like that. What would I have to do to get this to work?