We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 96ff328 commit 9e7bd10Copy full SHA for 9e7bd10
docs/tips/create-arrays.md
@@ -12,3 +12,10 @@ If you want to create an array pre-filled with some content use the ES6 `Array.p
12
const foo:string[] = new Array(3).fill('');
13
console.log(foo); // ['','',''];
14
```
15
+
16
+If you want to create an array of a predefined length with calls you can use the spread operator:
17
18
+```ts
19
+const someNumbers = [...new Array(3)].map((_,i) => i * 10);
20
+console.log(someNumbers); // [0,10,20];
21
+```
0 commit comments