es6 array literal conditional item code example
Example: js conditional array element
const cond = false;
const arr = [
...(cond ? ['a'] : []),
'b',
];
// ['b']
const cond = false;
const arr = [
...(cond ? ['a'] : []),
'b',
];
// ['b']