mirror of
https://github.com/ryanmcdermott/clean-code-javascript.git
synced 2025-04-08 06:51:48 +08:00
Fixing bad code example for over-optimization
This commit is contained in:
parent
b36557a90e
commit
0762d8fa07
@ -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++) {
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user