mirror of
https://github.com/Fechin/reference.git
synced 2026-11-20 21:23:11 +03:00
Merge pull request #724 from iamashruu/patch-2
Add example of entries() method with for...of loop in JavaScript
This commit is contained in:
1 file changed
+7
@@ -761,6 +761,13 @@ for (let fruit of fruits) {
|
||||
// => apple
|
||||
// => orange
|
||||
// => banana
|
||||
|
||||
for (let [index, value] of fruits.entries()) {
|
||||
console.log(index, value);
|
||||
}
|
||||
// => 0 apple
|
||||
// => 1 orange
|
||||
// => 2 banana
|
||||
```
|
||||
|
||||
## JavaScript Iterators {.cols-2}
|
||||
|
||||
Reference in new issue
Block a user