1 2 3 4 5 |
const isSomethingTrue = true; const myObject = { a: 1, ...(isSomethingTrue && {b: 5}) }; |
1 2 3 4 5 |
const isSomethingTrue = true; const myArray = [ 'a', ...isSomethingTrue ? ['b'] : [] ]; |
1 2 3 4 5 |
const isSomethingTrue = true; const myObject = { a: 1, ...(isSomethingTrue && {b: 5}) }; |
1 2 3 4 5 |
const isSomethingTrue = true; const myArray = [ 'a', ...isSomethingTrue ? ['b'] : [] ]; |