请问这段代码错在那个地方了?请问这段代码错在哪个地方了?

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**
function checkObj(obj, checkProp) {
// Only change code below this line
let t=obj.hasOwnProperty("checkProp");
let s=obj[checkProp];
if(t=="true")
return s;
else
return "Not Found";

return "Change Me!";
// 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/98.0.4758.102 Safari/537.36

Challenge: Testing Objects for Properties

Link to the challenge:

This literally says to check for the property called “checkProp”. That isn’t what you want.

You shouldn’t weakly compare against the string literal “true”.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.