DEV Community

Discussion on: 17 Javascript optimization tips to know in 2021 🚀

Collapse
 
murphy2134 profile image
murphy1312

// Longhand
if (first !== null || first !== undefined || first !== '') {
let second = first;
}
// Shorthand
let second = first|| '';

its not the same. first could be "0" or "[]".