I tried other ways too and everything else, it doesn’t give me even one thick. Is there anything I’ve been missing?
Your code so far
var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh",
city: "Seattle"
};
// Only change code bellow this line
function checkObj(obj, checkprop){
result = "";
if (myobj.hasOwnProperty(checkprop)){
return myobj.checkProp;
}
else{
return "Not Found";
}
}
// Only change code above this line
checkObj = ("gift");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36.
function checkObj(obj, checkprop) {
// Are you using this variable?
// If not, you should delete it.
result = "";
// Where did myobj come from?
// The function argument is obj!
if (myobj.hasOwnProperty(checkprop)) {
return myobj.checkProp;
} else {
return "Not Found";
}
}
Now let’s look at your function call:
// Only change code above this line
// It looks like you changed the code down here!
// There is no = in a function call!
// I would reset the code before you submit the code.
// When you call this, you need two arguments, matching the function definition above.
checkObj = ("gift");