When you declare a variable it's value is set as "undefined": if you subsequently try to add a number to it, it is converted to a string "Undefined" and a string concatenation is performed.
Either, check if the variable has a value before you add to it:
if (balance!=undefined)
{
...
}
Or initialise it when you declare it:
var balance = 0;