DEV Community

Discussion on: If not ternary operator then what?

Collapse
 
alainvanhout profile image
Alain Van Hout

Be careful with using && for fallbacks, since you need to keep in mind what counts as a falsy value in JavaScript (that includes e.g. an empty string or empty array, while you might have written the code with the expectation of getting either a (non-empty) array or null).