I want something like this and I would like to know if this is possible in JavaScript in one line, or I have to write an if statement
// these versions adds fasle to the array if condition = false
let arr = await getArray(params).push(condition && itemToAdd);
arr = await getArray(params).push((() => condition && itemToAdd)());
// this version adds undefined to the array if condition = false
arr = await getArray(params).push((() => { if (condition) return itemToAdd })());
(the reason I included the getArray part is cuz that's how it looks in my code and I don't actually save this array to a var arr only its being returned right away to its calling function, so that's why I don't want to add a line for the if statement...)