First, try checking the value
and typeof
the variable total
to ensure it is an integer.
You should also add a radix to your parseInt functions, as this may be causing a
, b
, or c
to be nAn
see mdn for example
I would also recommend installing a static analysis tool for sublime, something like Sublime-JSHint You will find it extremely useful for catching syntax errors.