I'm trying to do error handling on 2 input values. I'm using regex to confirm that the input is always a number. The issue I'm having is that I don't want my error handling to kick in if the user literally inputs 0. Right now I'm using:
number = parseInt(incomingValue) || ""
to set my variable. The issue is that this turns '0'
into ""
Its fine if an empty value becomes an empty string because I am disabling my error checking when the lengths are equal to 0
, but I need to properly turn '0'
into a number 0
. Anyone have any ideas?
Additionally, I'd also like to turn '000'
(and so forth) into a number 0