How to print fixed-point notation of a number in Node.js

1 Answer

0 votes
const num = 729.46702;
 
console.log(num.toFixed());
 
console.log(num.toFixed(1));
 
console.log(num.toFixed(2));
 
console.log(num.toFixed(3));
  
  
  
      
      
/*
run:

729
729.5
729.47
729.467
      
*/

 



answered Aug 12, 2022 by avibootz

Related questions

1 answer 142 views
1 answer 114 views
1 answer 108 views
1 answer 150 views
1 answer 135 views
...