`null` and default arguments
# Brendan Eich (10 years ago)
See esdiscuss.org/topic/default-operator-strawman-rather-than#content-13 and surrounding thread.
See https://esdiscuss.org/topic/default-operator-strawman-rather-than#content-13 and surrounding thread. /be Isiah Meadows wrote: > > I know it's a little late for this, but what was the rationale of > using only `undefined` instead of both that and `null` to denote > omitted values for optional arguments in ES6? Before this change, it > was a frequent idiom to check optional arguments via `== null` instead > of `=== undefined` and pass `null` as the argument to denote the > absence of a value. > > Just a curious question. > > _______________________________________________ > es-discuss mailing list > es-discuss at mozilla.org > https://mail.mozilla.org/listinfo/es-discuss
# Isiah Meadows (10 years ago)
Thanks! I understand now.
Thanks! I understand now. On Mon, Aug 17, 2015, 17:16 Brendan Eich <brendan at mozilla.org> wrote: > See > > https://esdiscuss.org/topic/default-operator-strawman-rather-than#content-13 > and surrounding thread. > > /be > > Isiah Meadows wrote: > > > > I know it's a little late for this, but what was the rationale of > > using only `undefined` instead of both that and `null` to denote > > omitted values for optional arguments in ES6? Before this change, it > > was a frequent idiom to check optional arguments via `== null` instead > > of `=== undefined` and pass `null` as the argument to denote the > > absence of a value. > > > > Just a curious question. > > > > _______________________________________________ > > es-discuss mailing list > > es-discuss at mozilla.org > > https://mail.mozilla.org/listinfo/es-discuss > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150817/34bda0bc/attachment.html>
I know it's a little late for this, but what was the rationale of using only
undefinedinstead of both that andnullto denote omitted values for optional arguments in ES6? Before this change, it was a frequent idiom to check optional arguments via== nullinstead of=== undefinedand passnullas the argument to denote the absence of a value.Just a curious question.