how can i define conditional array elements? i want to do something like this:
const cond = true; const myArr = [\"foo\", cond && \"bar\"]; >
const cond = true; const myArr = [\"foo\", cond && \"bar\"];
const cond = false; const myArr = ["foo", cond ? "bar" : null].filter(Boolean); console.log(myArr)
Will result in ["foo"]