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\"];
If you really want to keep it as a one liner, you could use:
const cond = true; const myArr = ["foo"].concat(cond ? ["bar"] : []);