More fun with undefined

Herby Vojčík herby at
Thu Jun 14 23:42:50 PDT 2012

T.J. Crowder wrote:
> Making a point of making this a separate thread from the current ?? and
> ??= thread(s), which are thankfully looking close to consensus. So
> that's infix and assignment.
> Question: Should we consider unary as well?

I also thought in these lines. What I came up is this:

(foo??)		// (foo !== undefined)
foo??bar	// (foo !== undefined) ? foo : bar aka foo ?? foo : bar

that is, allow ?? also without the operand, but then only at the end of 

it then allows |if (foo??)| or |let bar = foo??| (well, yes, ASI strikes 
back. again :-( I use semicolons always, but there's another school that 

> -- T.J.


P.S.: foo??bar:baz wouldn't hurt either, to complete the triad.

More information about the es-discuss mailing list