not able to get the code

Tell us what’s happening:
Describe your issue in detail here.

Your code so far


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

function checkObj(checkProp) {
// Your Code Here
if (myObj.hasOwnProperty(checkProp)){
return myObj[checkProp];}

else {return "Not Found";}}
// Test your code by modifying these values
checkObj("pet");

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.61 Safari/537.36

Challenge: Testing Objects for Properties

Link to the challenge:

HI @rmah9829 !

Welcome to the forum!

I would reset the lesson.

First off, the function needs both parameters here

function checkObj(obj, checkProp)

Do not change that.

Secondly, you are not supposed to create your own object.
This can be deleted.

The goal of this challenge is to test ANY object and check if the property exists or not.

You are not supposed to hardcode an object yourself.

You want to learn how to write reusable functions that can work with 100’s of examples.

Not just a few tests cases.

Hope that helps!

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