based on array value create condition js 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']