Basic JavaScript - Testing Objects for Properties

Can anyone tell me where im going wrong with this please ?

   **Your code so far**
function checkObj(obj, checkProp) {
 // Only change code below this line
 if (obj.hasOwnProperty(checkProp) === true){
    return checkObj.checkProp;
  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/103.0.5060.114 Safari/537.36 OPR/89.0.4447.51

Challenge: Basic JavaScript - Testing Objects for Properties

Link to the challenge:

You can’t use dot notation with variables holding the name of a property. You can only use dot notation with the exact, literal property name you want.

You may want to refresh your memory on when you can use dot notation with objects. Also, are you sure you want to use checkObj?

Ahh I always mix the up the function with the argument, cheers guys !

HI @FlashSampson !

Welcome to the forum!

Glad you were able to figure it out :+1:

As a helpful tip, you don’t need to include === true in your if statement

The hasOwnProperty() method returns a boolean (true or false)

You could just have this

if (obj.hasOwnProperty(checkProp))

Hope that helps! :+1: