0

If I want to check an object or an objects property is not undefined, I've done in following methods

  • if(object == null)

  • if(object === undefined)

  • if(object != null)

  • if(object !== undefined)

  • if(object && object.hasOwnProperty('foo'))

I keep coming across this kind of syntax in code bases object?.foo

Does this mean that, it check if the object is not undefined and then checks if the foo property is also not undefined?

Thanks!

Harry
  • 3,031
  • 7
  • 42
  • 67

0 Answers0