Parsing and converting exponential values to decimal in JavaScript

前端 未结 8 1582
梦毁少年i
梦毁少年i 2020-12-05 11:19

I want to parse and convert an exponential value into a decimal using JavaScript. 4.65661287307739E-10 should give 0.000000000465661287307739. What

8条回答
  •  無奈伤痛
    2020-12-05 12:05

    In ExtJS you can use Ext.Number.toFixed(value, precision) method which internally uses toFixed() method,

    E.g.

    console.log(Ext.Number.toFixed(4.65661287307739E-10, 10));  
    // O/p => 0.0000000005
    
    console.log(Ext.Number.toFixed(4.65661287307739E-10, 15));  
    // 0.000000000465661
    

提交回复
热议问题