Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • 15
    Well, it's hard to read but it's better than that verbose && method. +1.
    – shriek
    Commented Sep 15, 2016 at 21:06
  • 1
    That's the only real safe operator in javascript actually. The logical 'OR' operator that is mentioned above is something else. Commented Jun 21, 2017 at 13:55
  • @Filippos can you give an example of different behavior in logical OR vs && method ? I can't think of a difference Commented Jul 4, 2017 at 18:37
  • It also allows navigating an anonymous value without assigning it to a variable first. Commented Dec 1, 2017 at 13:59
  • 1
    Love it! Really useful if you want to get the property of an object after an array.find() operation that might not return any results
    – Shiraz
    Commented Apr 30, 2019 at 14:34