Skip to content

Instantly share code, notes, and snippets.

@YonatanKra
Created January 2, 2020 19:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YonatanKra/f345c0cd6f1c60e5f6dbc810d492846a to your computer and use it in GitHub Desktop.
Save YonatanKra/f345c0cd6f1c60e5f6dbc810d492846a to your computer and use it in GitHub Desktop.
function buildArray(n) {
const arr = [];
for (let i = 0; i < n; i++) {
arr.push(i);
}
}
function buildArray2(n) {
const arr = new Array(n).fill(0);
for (let i = 0; i < n; i++) {
arr[i] = (i);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment