Hello, I’m confused as to why my code is not passing the 3rd test. I successfully pass test 1 and 2 but the third test I’m receiving the same error. passing true when it should be false. my code is similar but I’m not sure what’s incorrect about it. Any insight would be great!
after altering the undefined portion I’m still receiving the same error for test 3 which is telling me that a value is returned as true when it should be false.
I did initially switch to the does not equal and still got the same error. If I’m understanding you correctly, key is not defined within object so I may have to do something like ` if (object[key] === undefined)"
Edit: this was the error and proved to be the solution;
upon changing object.key → object[key] ; my code passes all tests.
Ahh I see. I’m extremely literal so when I worked through the ideate portion of the problem I used false first. Changing object.key to object[key] actually fixed the error I was receiving in the 3rd test.
Something else to consider: The returns are boolean literals. What is the outcome of the condition? A boolean. So in fact, we don’t even need the if statement.
return object[key] !== undefined
We’ll still returning a boolean.
Another way to get a boolean result is with the in operator…
return key in object
Of course, this is a step above the naive level of a beginner, but not hard to grasp once we get some practice under our belt.