We recently implemented Logical Assignment in SpiderMonkey. The proposal gives programmers a shorthand for logical assignment. André Bargull [:anba] contributed the patches that implemented this proposal. It landed in Nightly this week.
We'll ship it once we're confident the specification is stable. The proposal is in stage 3 of the TC39 Process[1]. There is currently an open issue around anonymous functions[2] under discussion. Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1629106 Proposed Standard: https://tc39.es/proposal-logical-assignment/ Proposal Repository: https://github.com/tc39/proposal-logical-assignment/ MDN: not yet available Platform coverage: Nightly only, behind a pref DevTools bug: N/A Other browsers: Other browsers are willing to implement this. We are currently the first to have it implemented. Polyfills are partially available in babel[3] Testing: The patch[4] includes tests from test262. Use cases: The proposal is a shorthand for assigning default values. ```js // "Or Or Equals" (or, the Mallet operator :wink:) a ||= b; a || (a = b); // "And And Equals" a &&= b; a && (a = b); // "QQ Equals" a ??= b; a ?? (a = b); ``` [1]: https://tc39.es/process-document/ [2]: https://github.com/tc39/proposal-logical-assignment/issues/23 [3]: https://github.com/babel/babel/tree/master/packages/babel-plugin-proposal-logical-assignment-operators [4]: https://phabricator.services.mozilla.com/D70824 - yulia _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform