I know that below are the two ways in JavaScript to check whether a variable is not null, but I’m confused which is the best practice to use.
null
Should I d
Here is how you can test if a variable is not NULL:
if (myVar !== null) {...}
the block will be executed if myVar is not null.. it will be executed if myVar is undefined or false or 0 or NaN or anything else..
0
NaN