About hasOwnProperty

function checkObj(obj, checkProp) {
if(obj.hasOwnProperty(checkProp)) {
return obj[checkProp];
} else {
return “Not Found”;
Hey guys, I need some help with this code. It will be so hard to explain, but ill try. In this challenge, we have to check the property called checkProp. To do this, we write obj.hasOwnProperty…But why? obj is just an independent argument, that doesnt connected with checkProp at all, so why we use it to check the checkProp?

the goal is to check if the object obj has the checkProp property, hasOwnProperty is a method that can be used for that

but we have not object called “obj”. the only thing we have with this name, its an argument of function…

look at the tests, what’s passed in as argument?

as argument, we have (obj, checkProp)

those are the parameters, look at the tests, the arguments are what is passed in when the function is called