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 132 views
1 answer 105 views
1 answer 137 views
1 answer 93 views
1 answer 122 views
...