time taken upto 6 decimal in javascript code example

Example 1: how to numeric value is after point 2 values in javascript

var totalAmount = 0;
totalAmount = Number($("#sub_amount").val()) + Number($("#vat_amount").val());
totalAmount = totalAmount.toFixed(2);
$('#total_amount').val(totalAmount);
//@sujay

Example 2: get number right of the dot length javascript

var x = 23.453453453;
x.countDecimals(); // 9

var countDecimals = function (value) {
    if(Math.floor(value) === value) return 0;
    return value.toString().split(".")[1].length || 0; 
}