Tell us what’s happening:
Describe your issue in detail here.
Hello so after spending sometime in this chalenge i come to the conclusion that i had to use brackets , the simple way of accessing a proprierty by the . method does not work and I cannot understand why, Can someone give help me with this ?
I am talking about the return obj[checkProp]; line of code (I used to have return obj.checkProp; and it didnt work.
I have successufully finished the challenge but i could not understand why it didnt work and its bothering me.
Thank you for your time and help.
Your code so far
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
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36
Challenge: Basic JavaScript - Testing Objects for Properties
Link to the challenge: