I don't understand the difference between these two ways of checking if a variable is undefined:
if (typeof res.locals.user.hashnodes === 'undefined') {
morphemes = 0;
}
and
if (!res.locals.user.hashnodes) {
morphemes = 0;
}
For me, only the second option works, the first one doesn't. Anyone knows why?
(res.locals.user are the user settings I pass in my Node Js app).
Thank you!