NAN instead of 0

Issues related to forms.
Post Reply
User avatar
openomsk
 
 
Posts: 52
Joined: Thu Jun 20, 2013 8:59 pm
Location: Russia
Contact:

NAN instead of 0

Post by openomsk »

Hello! I have a question about calculations. For example, you add the values ​​of checkboxes and other elements. If none of the checkboxes is initially selected, or then NAN is given in the final amount. How can I make it be 0?
Last edited by openomsk on Wed Jan 25, 2023 8:35 am, edited 1 time in total.
User avatar
Pablo
 
Posts: 21707
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: NAN instead of 0

Post by Pablo »

What do you mean by 'cleaning'?
To which part of software is this question related?
User avatar
Pablo
 
Posts: 21707
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: NAN instead of 0

Post by Pablo »

Note that this is not specifiuc to WWB, this is standard browser behavior :
But you can use JavaScript to check for NaN

Code: Select all

isNaN()
https://developer.mozilla.org/en-US/doc ... ects/isNaN
Post Reply