How to generate random number as a string in Node.js

1 Answer

0 votes
const n = Math.random() * 10;
 
console.log(n.toFixed(2)); 

console.log(n.toFixed(0)); 

  
  
  
/*
run:
 
3.74
4
  
*/

 



answered May 24, 2022 by avibootz

Related questions

1 answer 106 views
1 answer 107 views
1 answer 111 views
1 answer 120 views
2 answers 170 views
2 answers 178 views
...