Default operator strawman - ||| rather than ??

Peter van der Zee ecma at qfox.nl
Tue Jun 12 15:10:11 PDT 2012


On Tue, Jun 12, 2012 at 10:56 PM, Tab Atkins Jr. <jackalmage at gmail.com> wrote:
> "undefined" is special-cased here because it's an extremely common
> value to check against.  It's used when an argument isn't supplied, or
> when you try to pull a non-existent property off of an object.

I believe the most common case for an undefined argument is to either
provide undefined OR null. I prefer null because it's not a global
look up and because it's shorter. So when I _have_ to write a function
call with empty parameter I supply null as the argument.

Where I'm going with that is to point out that the specific undefined
(only) case doesn't feel to be a "de facto standard" in the js world
to validate special syntax for it. And even if it did, please let it
take null into account as well. In these cases, who really does `x ===
undefined` opposed to just `x == null`?

- peter


More information about the es-discuss mailing list