Pls explain and find where I made a mistake

Am Sorry
I did not realise

That is your first code:

function checkObj(obj, checkProp) {

// Only change code below this line


                return obj[checkProp];


          return "Not Found";


//return "Change Me!";

// Only change code above this line


Please adjust it according to the recommendation of @ lasjorg:
if( obj.hasOwnProperty(checkProp) )

1 Like

please follow the instructions. You are not really required to console.log out the function. You are asked to check whether obj has a property checkProp. If it does have it return the value of checkProp. If it does not return the string ‘Not Found’

1 Like

I was able to pass it
But will not mind if u explain to me
function checkObj(obj,checkProp)
If I am to pass a param how will it work

And I am so grateful to u today thank you

1 Like

You first need to understand how function parameters work and how to use them

for instance, if i were to write a function that adds two numbers , logs out the result of the addition and returns their sum it would look like this:

function add(a,b) {
    let sum = a + b;
    return sum;

Parameters allow me to add whatever two numbers i would like when i use the function(which is when i call it) eg

// to add 5 and 6

in this case a becomes 5 and b becomes 6

I know how function works
But now I want to know how that testing objects function works
PL I don’t want to disturb you
I only want to learn