Testing Objects for Properties July 2021

Tell us what’s happening:
my code not accept by server. Even my output is same with the answer checklist. Please help.

Your code so far

// Setup
var myObj = {
gift: "pony ",
pet: "kitten ",
bed: "sleigh ",
city: "Seattle "

function checkObj(checkProp) {
// Your Code Here

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

// Test your code by modifying these values

Your browser information:

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

Challenge: Testing Objects for Properties

Link to the challenge:

Hi @aswad269 !

Welcome to the forum!

This comes up a lot in the forum.
You are not supposed to create your own object.

This is wrong.

You can just delete that.

Your job is to create function that check if obj has a property of checkProp.

You need to modify these lines of code to check for obj, not myObj.

Hope that makes sense!

1 Like

thank you for the reply. now i know why my code not accepted. really appreciate it @jwilkins.oboe .thank you.

1 Like

you have changed the function signature,

this is the starting code:

function checkObj(obj, checkProp) {
  // Only change code below this line
  return "Change Me!";
  // Only change code above this line

and the tests expect this kind of function
your function instead accepts only one argument

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