Https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties

Well this is my code and It’s not working . Can anyone help me?

function checkObj(obj, checkProp) {
// Only change code below this line
if(obj.hasOwnProperty(checkProp)){
  return obj[checkProp];
}
else{
  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/76.0.3809.132 Safari/537.36.

Challenge: Testing Objects for Properties

Link to the challenge:

Look very closely at what the instructions are telling you to return if the property is not found. This challenge will fail if even a single character is not correct.

1 Like

Hi use double quotes “Not found”

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

your issue is here:

If not, return "Not Found" .

are you returning this string?

1 Like