Testing Objects for Properties

Hello again,

I’m currently having trouble creating the code using var lookup method. (Yes, I checked the HINT which displayed a solution using IF/ELSE, but I went in this direction and am currently stuck. Please help me understand what I’m missing/doing wrong (probably everything lol but I’d still like to know what I did wrong). THANK YOU SO MUCH!

function checkObj(obj, checkProp) {
  // Only change code below this line
  var checkObj = {
    gift: "pony",
    pet: "kitten",
    bed: "sleigh",
    city: "Seattle"

  return checkObj[checkProp];
  return "Not Found";

  // Only change code above this line

What is this for?

You only need the function arguments for this challenge

1 Like

I was kinda basing it off the example and using the array key lookup method (and information found for what the excercise is “testing” for) . So I’m guessing this is NOT the way?

huuuu ok. I’ll try again

No - you don’t need to create any object inside of your function. The object is passed in as obj

1 Like

lmfao omg ok thank you for helping me understand that. I’ll working on this problem. THANK YOU!

1 Like

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