Using JavaScript, how do I NOT detect 0, but otherwise detect null or empty strings?
Using JavaScript, how do I NOT detect 0, but otherwise detect null or empty strings?
I know this might be a too late answer but it might help someone else.
If I understand you correctly you want the below statement to exclude the 0:
if(!value) {
//Do things
}
I think the easiest way to do this is to write the statement like this:
if(!value && value !== 0) {
//Do things
}
I hope this helps.