avoid NaN (Not a Number)

This is how to avoid NaN (Not a Number)

        // Get the Text value from the BT Amount Display that will be in Currency format
        let btAmount = $("#BtamountDisplay").val();
        console.log("BT Amount Before Conversion: " + btAmount);

        // Remove $ or , characters to get just the number
        let cleanString = btAmount.replace(/[$, ]/g, '');
        let dblBtAmount = parseFloat(cleanString);

        console.log("BT Amount After Conversion: " + dblBtAmount);

 

Add comment

Loading