Testing Objects for Properties has a bug

Testing Objects for Properties has a bug
0

#1

Using “dot” notation doesn’t work to recall the property, but using bracket notation works just fine. This appears to be a bug. Dot notation was working just fine prior to this example.

// Setup
var myObj = {
  gift: "pony",
  pet: "kitten",
  bed: "sleigh"
};

function checkObj(checkProp) {
  if ( myObj.hasOwnProperty(checkProp) ) {
    return myObj.checkProp;
  }
  return "Not Found";
}

// Test your code by modifying these values
checkObj("bed");

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0.

Link to the challenge:


#3

OK, that was not entirely clear. I knew the spaces required the brackets, I didn’t realize it was everything but non-spaced strings…I guess I should just use brackets all the time then.