Basic JavaScript - Testing Objects for Properties

Tell us what’s happening:
Describe your issue in detail here.
I think there’s something wrong with this question. There is no video to show the how-to-go-about and the example is very different from the main question. Anyone to add to what I hink?

I would like help on how to go about
Your code so far

function checkObj(obj, checkProp) {
  // Only change code below this line
  return object.hasOwnProperty(checkProp);


  // Only change code above this line
}

Your browser information:

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

Challenge: Basic JavaScript - Testing Objects for Properties

Link to the challenge:

You are close to the answer, there’s needed one more change.

Similarly to how hasOwnProperty method is using checkProp - parameter passed to the function, the obj also needs to be used. obj is the object which should be tested if it has the specific property.

You are confusing me more. Can you explain it simpler?

I don’t understand the values that are displayed in the list of errors when I run the code, e.g.

" checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "gift") "

Where do they get that? I did not even input that?

Or should I make my own example like how they did here on this code below: checkForProperty({ top: 'hat', bottom: 'pants' }, 'top'); // true checkForProperty({ top: 'hat', bottom: 'pants' }, 'middle'); // false

Take a look at the function parameters

function checkObj(obj, checkProp)

When checkObj({gift: "pony", pet: "kitten", bed: "sleigh"}, "gift") is called, the obj will be {gift: "pony", pet: "kitten", bed: "sleigh"}, and checkProp - "gift".

I will attend again tomorrow. I still DON’T understand. For the day, I’m done. I’ll look for other Websites that will help me with this. Thank you.

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