Members’ deposits arrive as text and are checked before they are added: global isNaN, Number.isNaN, or x === NaN. Which check really stops an entry in words…
A check for "is this a number?" is often written with isNaN, and it refuses or lets through the wrong things: undefined, empty text, words. One NaN that slips through spreads to every sum after it.
isNaN asks "turned into a number, is it NaN?", Number.isNaN asks "is this NaN?"
isNaN lets through or refuses the wrong entries isNaN converts first: isNaN(undefined) is true, isNaN('') false. Convert and check with Number.isNaN(Number(x)) or Number.isFinite(Number(x)), and refuse empty entries yourself.x === NaN is always false even when x is NaN NaN equals nothing, itself included. Use Number.isNaN(x) or x !== x.Number('') and Number(' ') are 0, not NaN. Check x.trim() === '' before converting.isNaN(x) 'dua ribu' is refused and the total is a number again.undefined in a row, try two checks isNaN(undefined) is true, Number.isNaN(undefined) false. The "differs" row under the code lights up.x === NaN check on a NaN row It never refuses anything, not even NaN itself.