How to create an array containing random less then one numbers in JavaScript

1 Answer

0 votes
const len = 4;  

let arr = Array.apply(null, {
  length: len
}).map(Function.call, Math.random)
 
console.log(arr)
  


    
    
/*
run:

[0.19285601301856026, 0.1789833606377793, 0.4840564254709282, 0.06086267581453142]
    
*/

 



answered Jan 28, 2021 by avibootz
...