Same code, different effects

Tell us what’s happening: I have the same code as the video does (my code is on the bottom), but only the code works when copy and pasted. This also happened on a different JS lesson.

Your code so far


function checkObj(obj, checkProp) {
// Only change code below this line
//video code
if(obj.hasOwnProperty(checkProp)) {
  return obj[checkProp];
} else {
  return "Not Found";
}
//my code
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 (X11; CrOS x86_64 12871.102.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.141 Safari/537.36.

Challenge: Testing Objects for Properties

Link to the challenge:

Welcome @just_matt

  • Did you wrap your code into a function too?
  • What do you mean by ‘doesnt work’? Is there an output error?

Welcome to the forums.

It looks like you have a capitalization error in Not Found.

Oh, I see. Yeah, the capitalization and case sensitive answers in these lessons always messes me up. Thanks

1 Like