Testing Objects for Properties 151

Tell us what’s happening:

Your code so far


function checkObj(obj, checkProp) {
// Only change code below this line
if (myObj.hasOwnProperty(checkProp)) {
  return myObj[checkProp];
}
else {
  return "Not Found";
}
// Only change code above this line
}

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; ) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36.

Challenge: Testing Objects for Properties

Link to the challenge:

Please describe how u call function.

sorry… i didn’t get what you are saying.
please explain.

You just gave the definition of the function, not how you called the function, please give your input and output

This is the challenge which i was trying to complete :


I am directly submitting the code provided by me. I am not calling the function or giving any input as it is not required

Here I can pass the test normally, it should not be the problem of the code.

what’s myObj? the function is defined with obj and checkProp
remember you can’t use stuff that was not declared before, myObj wasn’t declared or defined before it is being used

thanks…silly mistake