Basic JavaScript - Testing Objects for Properties

** checkObj({pet: "kitten", bed: "sleigh"}, "gift") should return the string Not Found .**
It looks like it’s asking me to make return gift: “pony” on one task but on the other it asks me to return gift - “Not Found”
so the answers changes either wrong on the first task or on the last one
Your code so far

function checkObj(obj, checkProp) {
  // Only change code below this line
 var checkObj = {
   gift: "pony",
   pet: "kitten",
   bed: "sleigh",
   city: "Seattle"
 } ;
var answer = "";
 if (checkObj.hasOwnProperty(checkProp)) {
    return checkObj[checkProp];
 } else {   
   return "Not Found"
 }
      // Only change code above this line
}

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15

Challenge: Basic JavaScript - Testing Objects for Properties

Link to the challenge:

All of your code is ignoring the function argument obj. You must use obj.

how should I use it ?
so the only problem that comes is that
gift supposed to return - “Not Found”

You are using checkObj, but you should never have created checkObj. Creating and using checkObj totally ignores the obj you were asked to check.

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