How to generate random number as a string in TypeScript

1 Answer

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

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

  
  
  
/*
run:
 
"1.81" 
"2" 
  
*/

 



answered May 24, 2022 by avibootz
...