Testing Objects for Properties

The problem doesn’t mention any “gift”, “pony”, etc. and it’s asking for that in the solution when i run the test. Am i missing something or is this an error ? Any help would be appreciated!

HI @simarsahota1811 !

Welcome to the forum!

A lot of people get tripped up on this challenge.

Not exactly.

The those objects passed into the function call are used to test your function.
The correct answer should work for 100’s of different objects.

checkObj is the name of the function so you don’t want to use that in your if statement on line 3. You need to instead use the function parameter of obj.
Remember that obj is a parameter and acts as a placeholder for when the function is called and a real object is passed in.

On line 4, you don’t want to write checkObj['obj'].
Instead, you need to use the parameters of obj and checkProp

The goal of this lesson is teach you about the hasOwnProperty method but also teach you how to use function parameters.

Hopefully that helps

Also in the future, it is best to use the ask for help button in the challenge which will generate your code for you with the challenge :+1: