Skip to content

Commit 655d432

Browse files
committed
Update guidance
1 parent f4be00e commit 655d432

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

docs/style-guides/javascript/README.md

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -906,17 +906,14 @@ for ( i = 0; i < arr.length; i++ ) {
906906

907907
##### Notes
908908

909-
- Do **not** use the `new` operator if the `array` length is [greater than][array-fast-elements] `64000` due to how compilers handle "fast" elements. Instead, to ensure "fast" elements,
909+
- Do **not** use the `new` operator if the `array` length is **very large** due to how compilers handle "fast" elements. Instead, to ensure "fast" elements,
910910

911911
```javascript
912-
var len = 100000;
913912
var arr;
914913
var i;
915-
arr = new Array( 64000 );
916-
for ( i = 0; i < arr.length; i++ ) {
917-
arr[ i ] = Math.random();
918-
}
919-
for ( i = arr.length; i < len; i++ ) {
914+
915+
arr = [];
916+
for ( i = 0; i < 1e7; i++ ) {
920917
arr.push( Math.random() );
921918
}
922919
```
@@ -3607,8 +3604,6 @@ This document may be reused under a [Creative Commons Attribution-ShareAlike Lic
36073604

36083605
[ecma-262]: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
36093606

3610-
[array-fast-elements]: https://github.com/thlorenz/v8-perf/blob/master/data-types.md#fast-elements
3611-
36123607
[function-statements]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function
36133608

36143609
[function-expressions]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/function

0 commit comments

Comments
 (0)