3 ms·
>This line "(a.c || [])()" is bothering me -- why on earth would this line exist in any program? A variation of it is valid for method selection, such as: (
by wruza 8y ago
>This line "(a.c || [])()" is bothering me -- why on earth would this line exist in any program?
A variation of it is valid for method selection, such as:
(cond ? a.foo : b.bar)();
or, for method fallback:
(a.foo || a.fooDefault)();
Neither does work in js, though.
- anonytrary 8y agoThis is useful and works with functions that don't use `this` (like arrow functions).