Hi I am trying to solve this question but not working, don't know what is the problem almost tried everything.Can someone help please!

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
}

I’ve edited your code 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.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

Can you provide a link to the challenge you are on

Ok ,Thank you sir, I am using this first time

checkprop should not be in quotes here. You are already setting checkProp as a parameter to the function. In this case it would just be used like a variable

if(obj.hasOwnProperty('checkProp'))
1 Like

Thank you sir it worked

1 Like