I'm reading a book that says that while it's possible to test whether a variable is defined and has a value by doing:
if(myVar != null && myVar != undefined) {
...
}
this is considered “poor style”, and that since both null and undefined are falsey values, we can more easily check if a variable has a value by using the more concise if construct
if(myVar) {
...
}
But this confuses me, because while it’s true that null and undefined are falsey values, they are not the only falsey values. In other words, it seems to me that the former if statement says, "run the code as long as the variable isn't null or undefined, whereas the latter if statement is saying, "run the code as long as the variable isn't falsey." Supposing myVar == 0, then the former if statement would run, but the latter if statement would not. Therefore these two if statements are not equivalent. Am I wrong?
EDIT: Here's a screen grab if you want to see their exact wording:

myvarvariable is a number then you can useisNaNfunction.