This part segment is Unfinished (UNFINISSHED)

Tell us what’s happening:
Yo you missed a part of the code in the part no where in the test text or video does it tell you to code the var
for myObj

Your code so far

        if (myObj.hasOwnProperty(checkProp)) {
    return myObj[checkProp];
  } else {
    return "Not Found"
  }
}

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 (Linux; Android 6.0.1; q201_9377) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.162 Safari/537.36.

Challenge: Testing Objects for Properties

Link to the challenge:

the video is for a previous version of the challenge

now the function has two parameters, not only one.

and you are not using one of them

2 Likes

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.

markdown_Forums

1 Like

The instruction video is bit old I think and the exerciser is bit different now. In the video it shows a method below
function checkObj(checkProp)

But exerciser is changed and now the method is like below

function checkObj(obj, checkProp)

So with this you need to send the object you are checking the prop as well to the method. That is a more practical way of doing things. So in your code you need to myObj to obj so that it reflects the 1st parameter of the function

1 Like

Oh ok I usually just watch the video the video 1st I didn’t get why my code was wrong because I know I done it right. :relieved: