FUNCTIONS AND THEIR PARAMETERS
Help! I don’t know how to access the checkObj(obj) function or maybe I’m not writing it right. In the return part of my code, what I’m trying to output is that whatever checkProp is, I want it to go to obj, check what the value is and return it. I’ve been stuck on this for days.
**Your code so far**
function checkObj(obj, checkProp) {
// Only change code below this line
if (checkObj.hasOwnProperty(checkProp)){
return checkProp.obj;
} else {
return "Not Found";
}
// Only change code above this line
}
**Your browser information:**
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.1 Safari/605.1.15
Challenge: Basic JavaScript - Testing Objects for Properties
Okay so, the first question we need to ask is: what does the function checkObj do?
At the moment it seems to be taking in two parameters something called obj and something called checkProp.
In your post you said this:
whatever checkProp is, I want it to go to obj, check what the value is and return it.
So you are saying that checkProp is something related to obj right? In that case, do you think you should ask obj the question? Right now your code says
if (checkObj.hasOwnProperty(checkProp))
So you are asking “checkObj” not obj.
Does it make sense to ask checkObj this question? (Who would know the most about obj but obj?)