Fixing bad code example for over-optimization

This commit is contained in:
Fakhruddin Ali Hussain 2019-11-21 11:40:44 -08:00 committed by GitHub
parent b36557a90e
commit 0762d8fa07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -980,7 +980,7 @@ they are fixed if they can be.
```javascript
// On old browsers, each iteration with uncached `list.length` would be costly
// because of `list.length` recomputation. In modern browsers, this is optimized.
for (let i = 0; len = list.length; i < len; i++) {
for (let i = 0, len = list.length; i < len; i++) {
// ...
}
```