How to avoid scientific notation for large numbers in JavaScript?

后端 未结 22 2064
無奈伤痛
無奈伤痛 2020-11-22 00:31

JavaScript converts a large INT to scientific notation when the number becomes large. How can I prevent this from happening?

22条回答
  •  忘了有多久
    2020-11-22 00:53

    one more possible solution:

    function toFix(i){
     var str='';
     do{
       let a = i%10;
       i=Math.trunc(i/10);
       str = a+str;
     }while(i>0)
     return str;
    }
    

提交回复
热议问题