Tell us what’s happening:
Describe your issue in detail here.
My code didn’t pass the test. First, I was confused about the property that has to be checked about. No specific property was stated. I used the obj and checkProp as they are in the challenge. Running the test there were in the result properties that I can’t invent. Seeking help, I found from the hint and the solution that what I did was OK but was lacking an if and an else statements. Adding that and rerunning the test, the result remained the same and the given solution is now in doubt.
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/114.0.0.0 Safari/537.36 Edg/114.0.1823.37
Challenge: Basic JavaScript - Testing Objects for Properties
Link to the challenge: