Could someone please help me with testing the objects for properties:
I don’t know how to do it.
function checkObj(obj, checkProp) {
// Only change code below this line
if (obj.hasOwnProperty(checkProp)) {
return obj[checkProp];
} else {
return "Found";
return "Not Found";
// Only change code above this line
}
Challenge: Basic JavaScript - Testing Objects for Properties
first, fix the correct quantity of curly brackets, remember to open and close all code blocks. (i would start using indentation to help see code blocks).
then ask yourself what the code will do when it runs, specifically the part hbar1st highlighted.