3 ms·
Not sure about the proposed form, but having proper expression-only ifs in arrays and objects would be nice. Including the spread syntax. [ "foo”, if
by wruza 5y ago
Not sure about the proposed form, but having proper expression-only ifs in arrays and objects would be nice. Including the spread syntax.
[
"foo”,
if (cond1) bar,
if (cond2) ...baz,
]
Pretty sure it was already proposed and rejected, but still.
- archduck 5y agoThis ain’t pretty, but it works: [ “foo”, ...(cond1 ? [bar] : []), ...(cond2 ? baz : []), ] --- Edit: note to self: read the link before commenting.