Challenge is buged

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**

function checkObj(obj, checkProp) {
// Only change code below this line
const myObj = {
if (myObj.hasOwnProperty(checkProp)){
  return myObj[checkProp];
} else  {
  return "Not Found";
// Only change code above this line

So challenge is that if you type gift you get pony, but also if you type in gift you should get not found.

  **Your browser information:**

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

Challenge: Testing Objects for Properties

Link to the challenge:

if u check the function declaration / function header / function signature (or whatever u wanna call it… all the same thing)

function checkObj(obj, checkProp) {

u will notice it have 2 parameters… obj and checkProp
soo u NO need to create ur own object (myObj on ur code)

You’re hard coding one specific object (the example) into the function, meaning that if an object with different properties is given to the function (as in the tests) your function will return the wrong answer.

1 Like

You are using a hard coded object

And you are totally ignoring the function argument.

This challenge works correctly when you use the function argument. Using a hard coded object sort of misses the whole reason behind using functions.

1 Like

Hahaha thank you. So simple than

Thank you. Didnt understand this one

Thank you very much…

@josip.gajski7 I have a somewhat unrelated question. How did you get to that code, did you do a search for it on the forum?

Edit: I only ask because we are trying to make sure people do not find old solutions to challenges that may have been changed. And it seems to have somewhat worked with this challenge, so I’m just curious how you found the code.