I have number which has 18 decimal points. I want to get the digits before the decimal points in a variable and the digits after the decimals in another variable.
Let's say the original variable value is 100,
I want to show that like this
100.000000000000000000 but now I am getting
100000000000000000000 (without decimal point)
I am trying to print the digits before the decimal points in a HTML element and the rest in another HTML
<div class="original"></div> var original = data['result']; $(".original").html(original]);
100000000000000000000 in the element original and that's fine.
Now I want to print the digits before the decimal points in a HTML element 'beforeDecimal' and point then the rest
So my mark up is:
<div class="beforeDecimal"></div> . <div class="afterDecimal"></div> var beforeDecimal = data['result']; // how do I have to change this ? $(".beforeDecimal").html(beforeDecimal]); var afterDecimal = data['result']; // how do I have to change this ? $(".afterDecimal").html(afterDecimal]);
if I use
var beforeDecimal = parseFloat(data['result']).toFixed(4); is shows
100.00000000000e+21 but I want
100 . 000000000000000000
How can I do this?