FCC Code editor rendering wrong results - Testing Objects for Properties

Ran solution through a console outside of FCC editor:

function checkObj(obj, checkProp) {
  // Only change code below this line
  if (obj.hasOwnProperty(checkProp)) {
    return obj[checkProp];
    } else {
      return "Not found!";
    }
  }

checkObj({gift: “pony”, pet: “kitten”, bed: “sleigh”}, “house”)
“Not found!”
checkObj({city: “Seattle”}, “district”)
“Not found!”
checkObj({pet: “kitten”, bed: “sleigh”}, “gift”)
“Not found!”

This code passes the test.

Alternative same code when it’s ran through the FCC code editor, renders different results:

// running tests
checkObj({gift: “pony”, pet: “kitten”, bed: “sleigh”}, “house”) should return the string Not Found.
checkObj({city: “Seattle”}, “district”) should return the string Not Found .
checkObj({pet: “kitten”, bed: “sleigh”}, “gift”) should return the string Not Found
. // tests completed

Why different results? Bug? Please help… very stuck!

Please post a link to the challenge.

My apologies… newbie onboard. Please see link below:

This isn’t quite what the instructions are asking you to return. You must return the exact string in the instructions.

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