Skip to content

Instantly share code, notes, and snippets.

@prof3ssorSt3v3
Created June 28, 2019 16:32
Show Gist options
  • Save prof3ssorSt3v3/9deed3aacb2cbab9158cf6daa2bb9b10 to your computer and use it in GitHub Desktop.
Save prof3ssorSt3v3/9deed3aacb2cbab9158cf6daa2bb9b10 to your computer and use it in GitHub Desktop.
//version 1
let a1 = Array.from({
length: 5
}, n => Math.random());
console.log('1', a1);
//version 2
let a2 = new Array(5).fill(1).map(n => Math.random());
console.log('2', a2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment