Are you familiar with https://github.com/tc39/proposal-logical-assignment/ ?
On Mon, Apr 13, 2020 at 2:17 AM Sultan <[email protected]> wrote: > The following would assign to the address foo in obj if and only if it has > not already been assigned. > > var obj = {} > var foo = Math.random() > obj[foo] ?= 1 > > The same can be said for: > > var undef > undef ?= 1 > > Which could both be transpired to > > type obj[foo] === 'undefined' && obj[foo] = 1 > > or > > type a === 'undefined' && undef = 1 > > respectively. > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

