Lodash Project - has()

I’ve implemented the formula to return true if obj[key] is not undefined, and now I want to test if the output will be correct but am having trouble putting together console.log().

I tried using the following to see if I will see true in the console but it returned false.
console.log(_.has({cat: {age: 3}},'age'));
Can someone help what I’m missing?

  if (obj[key]===undefined) {return false}
  else {return true}

Nested object could be the issue.

1 Like

I see…it should have been something like below.

1 Like