What am i doing wrong in the code

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
var checkprop ={
 gift: "pony",
 bed: "sleigh" 
return  checkprop[val];

// Only change code above this line
  **Your browser information:**

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

Challenge: Testing Objects for Properties

Link to the challenge:

…what are you even doing there?
The task is about using .hasOwnProperty() → I don’t see that method in your code.
Plus the function takes in obj and checkProp, but you immediatly override checkprop with some random object and then try return something with val in it, despite the fact there is no val getting declared anywhere. And you never use obj.

tl;dr: delete that, go back to the beginning and start by reading and understanding the explanation before the task.

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