Avoid `null` in JavaScript

Use undefined instead.

Why?

`null` bypasses default function value checkers AND it's typeof is an 'object'.

This leads to weird stuff.

'undefined' will respect default values set and won't validate and an 'object'
I prefer how `return null` reads in code but the edge cases....

(╯°□°)╯︵ ┻━┻
You can follow @DavidWells.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled: