Is there a universal JavaScript function that checks that a variable has a value and ensures that it\'s not undefined or null? I\'ve got this code,
undefined
null
return val || 'Handle empty variable'
is a really nice and clean way to handle it in a lot of places, can also be used to assign variables
const res = val || 'default value'