Please tell me exact error in coding. Many Thanks

I tried it many ways . Please tell me solution . Thanks .

Your code so far

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

function checkObj(checkProp) {
// Your Code Here
if (myObj.hasOwnProperty(checkProp)) 
return myObj[checkProp]; // If true return the prop

return "Not Found";
}

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

Your browser information:

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

Challenge: Testing Objects for Properties

Link to the challenge:

You changed the starting function.

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

The obj parameter is the object. The tests will pass the object to the function when it calls it.

  1. Remove the myObj object.

  2. Add back the obj parameter.

  3. Change all references to myObj with obj inside the function.

You found an old solution for this challenge. If be careful copying old answers, as the challenges get updated every so often.

1 Like

Madam , I have tried in many ways .I have seen mostly people share this coding . I was thinking , may be it will work . I have already used as obj inside the function , it did not work .

Most important in coding to understand logic . it does not matter copy paste , logic should be clear in our mind . I know very well , I can find solution in many ways . I tried my best to find solution .

Getting the answer to the challenge is really not that important. Practicing the ability to solve problems is the key. Learning how to read the code of others is important but it is completely different than learning how to write your own code.

You won’t always have other people’s code to copy. For example, no solutions to copy are provided for the certification projects. Also, people pay programmers to write new code, not to transcribe somebody else’s code.

Save reading the solutions of others for after you have written code that works. That way you can practice both problem solving and reading other people’s code.


What does your code look like with the correct function signature? You function must take two arguments, not one. What does your code look like with obj instead of myObj? Both of those problems must be fixed for your code to work.

1 Like

Madam , I have completed master of computer application . I have done so many projects by myself . listen sometimes this website wants answer their way , not our way . Thats way I asked is this code is right ? I tried in many ways . I have already certification for 3 years . I am here for enjoying coding . if i cannot understand , I can ask . Many people can take help from another person by this website . But I have already done master in college , not online certification. please do not teach me , if you cannot help . I just asked question to make sure it. Many programmers programs can be same or can be different. its important it should work for client . you cannot change logic and rules of programming and bring new program. you can do in different ways , may be same with other people . Online Certification anyone can take help from others , how can you judge ??? I am not saying getting challenge is important , please understand . logic should be in clear in mind . If it is challenge, then why does website give get help option . There is help option , I have used it , what is your problem ?? I know what am i doing . Do not judge people . If you cannot help , enjoy please stay away

You have been told exactly how to fix this twice now. You should be able to fix this from the two steps you have been told.

  1. Put the function argument obj back. Your function signature must be function checkObj(obj, checkProp. You must not use function checkObj(checkProp).

  2. Only use obj inside of your function, not myObj. You must not use myObj.

Have you tried this? What does your code look like with these two fixes? If you make these two changes and still have issues, please post your updated code. We can help you fix any further issues after you have fixed these two.

1 Like

do not reply me stay away … I have tried it already . it did not work . you are insulting other people . I do not need your help stay away . you think you are perfect . you are fooling yourself . stay away .

No one is trying to insult you, everyone here is just trying to help others learn. You said that you tried the suggested solutions? If its still not working post the new code and we can keep trying and guide you to another solution. People here try not to just tell you the answer because the point is to learn and understand why something is or is not working. That way later on down the road you can fix these problems yourself and not have them be a road block.

2 Likes

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