-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy path4-array.js
More file actions
16 lines (12 loc) · 358 Bytes
/
Copy path4-array.js
File metadata and controls
16 lines (12 loc) · 358 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
'use strict';
const iterable = [0, 1, 2];
const iterator = iterable[Symbol.iterator]();
const step1 = iterator.next();
const step2 = iterator.next();
const step3 = iterator.next();
const step4 = iterator.next();
console.log({ step1, step2, step3, step4 });
for (const step of iterable) {
console.log({ step });
}
console.log({ steps: [...iterable] });