To differentiate between "" and 0, use the triple-equals === for equality checks. This ensures that the types between the two operands are consistent, not merely equivalent in the course of evaluation. Example:
"" == 0 // returns true
"" === 0 // returns false
Also, whenever you find a bug, you should fix it. This practice improves not only maintainability, but also security. All security flaws are bugs, therefore less bugs means less security vulnerabilities.