File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -21,15 +21,15 @@ the actual indexes of the array will not be initialized.
21
21
arr[1]; // undefined
22
22
1 in arr; // false, the index was not set
23
23
24
- The behavior of being able to set the length of the array upfront only comes in
25
- handy in a few cases, like repeating a string, in which it avoids the use of a
26
- ` for loop ` code.
24
+ Being able to set the length of the array in advance is only useful in a few
25
+ cases, like repeating a string, in which it avoids the use of a ` for loop `
26
+ code.
27
27
28
28
new Array(count + 1).join(stringToRepeat);
29
29
30
30
### In Conclusion
31
31
32
- The use of the ` Array ` constructor should be avoided as much as possible.
33
- Literals are definitely preferred. They are shorter and have a clearer syntax;
34
- therefore, they also increase the readability of the code .
32
+ The use of the ` Array ` constructor should be avoided. Literals are definitely
33
+ preferred. They are shorter, have a clearer syntax, and increase code
34
+ readability.
35
35
You can’t perform that action at this time.
0 commit comments