An operator syntax for the the "typeof" pattern used to detect if a
environment/object has a value:

if (typeof variable === 'undefined') {...}
if (typeof object.key === 'undefined') {...}

This could manifest in destructuring as the following

var fn = ({ key ||= 1 }) => {
}

And with variables as:

var global ||= {}

Equivalent code:

(arg) => {
    if (typeof arg.key === 'undefined') {
        arg.key = 1
    }
}

if (typeof global === 'undefined') {
var global = {}
}
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to