Wrong tests on exercise Basic JavaScript: Testing Objects for Properties

Tell us what’s happening:

There are 2 test that looks that dont belong to the exercise
// running tests

checkObj({city: "Seattle"}, "city")

should return

"Seattle"

. // tests completed

Your code so far


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

function checkObj(obj, checkProp) {
 // Only change code below this line

 if (myObj.hasOwnProperty(checkProp) == true) {
   return myObj[checkProp];
 }
 else {
//  and change the value of `return` in `else` statement:

   return "Not Found"
 }


 // Only change code above this line
}

checkObj(myObj, "gift");

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36.

Challenge: Testing Objects for Properties

Link to the challenge:

Hello there.

You are not using the obj parameter passed to the function checkObj.

Hope this helps.

@fede1 The two tests belong. The tests show you what object is being passed to the function. The myObj will be deleted shortly as it was left over from a previous version of the challenge. We are just waiting on a pull request to remove it from the challenge code.

Thanks for the feedback Randell :slight_smile: