I have a variable that I past to a function called comment_test that will sometimes be 0, but it fails because I guess it reads it as false. I get the error 'ReferenceError: Can't find variable: count'.
But, I need to know if the variable is indeed 0 (and not 1, 2, 3, etc). The function works fine with any positive number. How is this achieved or what am I doing wrong? I can’t seem to find any info on this.
var test = comment_test(0, true);
You should use the strict comparison :