Skip to content

Instantly share code, notes, and snippets.

@unlocomqx
Last active May 23, 2019 21:36
Show Gist options
  • Save unlocomqx/441d556dd95396de66907f89a37f0881 to your computer and use it in GitHub Desktop.
Save unlocomqx/441d556dd95396de66907f89a37f0881 to your computer and use it in GitHub Desktop.
const condition = false;
const myArray = [
"value 1",
"value 2",
condition && "value 3",
!condition && "value 4"
].filter(Boolean);
console.log(myArray);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment