Homepage
Sign in / Sign up
  • Share
Go to the profile of Rick Lubbers
Never miss a story from Rick Lubbers, when you sign up for Medium. Learn more
Never miss a story from Rick Lubbers
Go to the profile of Rick Lubbers
Rick Lubbers
Genius at rest.
Feb 12, 2016
Functional Javascript — Null, Undefined and the Option Pattern
Tibor Botos
51

How about not using ===, but just ==? This does everything you seem to want.

These expressions all evaluate to true:

undefined == null

"" != null

0 != null

Don't make life any harder than it has to be :)

  • Go to the profile of Rick Lubbers

    Rick Lubbers

    Genius at rest.