I know, I know there must be some threads covering this topic. But I used the search and didn't get the answer which fits my needs. So here we go:
i want to check one "if" condition , in that if variable is having values like "null" or "undefined" or "" or '' then i want to assign variable value as "N/A" & if value is zero (0) it should not assign "N/A" to that variable.
But the problem is here that "" or null == 0 is true,
So please help me to get out this problem, Thanks in Advance
Use ===
for comparisons in JavaScript,
// type doesn't match gives false
0 === null; // false
0 === undefined; // false
0 === ''; // false
0 === false; // false
0 === "0"; // false
// type matches
0 === 0; // true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With