I am not able to get desired output even after seeing solution from codecamp

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**

function checkObj(obj, checkProp) {
// Only change code below this line
  return("Not Found");
// Only change code above this line

  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 OPR/77.0.4054.203

Challenge: Testing Objects for Properties

Link to the challenge:

First, I strongly recommend against trying to copy other people’s solutions. It holds back your learning and it is a big source of bugs.

In this case, you have copied bad syntax for the hasOwnProperty() method and using bracket notation to access a property.

checkProp is a variable that holds the string name of the property you want to check for, so you should not add quotation marks around it.

Also, you shouldn’t put ()s around the return value. That is incorrect syntax.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.