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 109 views
1 answer 111 views
1 answer 114 views
1 answer 122 views
2 answers 175 views
2 answers 182 views
...