Testing Objects fr Properties Help

Testing Objects fr Properties Help
0

#1

Hey , i dont understand why this wouldnt pass.
Could someone explain the problem to me in another way??
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/testing-objects-for-properties
This is My code : …


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

function checkObj(checkProp) {
  if(myObj.hasOwnProperty(["gift"],["pet"],["bed"])){
    return true;
  } else { return "not Found";}
  // Your Code Here
  
  return "Change Me!";
}

// Test your code by modifying these values
checkObj("gift");

#2

I don’t know what the tests are expecting.

Can you format your code and add a link to this challenge?


#3

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.


#4

Look at the last line, it’s already submitting values for you.

You have to handle this dynamically. So instead of passing each value to your hasOwnProperty method, just pass in checkProp without brackets. Then return it if it’s there.