JS Coding Questions Logo
JS Coding Questions
#47🎯 Exercise💻 Code

JavaScript Coding Exercise 47

Advertisement

728x90
javascript
1const myGenerator = (function* () {
2
3yield 1;
4
5yield 2;
6
7yield 3;
8})();
9
10for (const value of myGenerator) {
11
12console.log(value);
13
14break;
15}
16
17for (const value of myGenerator) {
18
19console.log(value);
20}

Choose the correct output:

A
1,2,3 and 1,2,3
B
1,2,3 and 4,5,6
C
1 and 1
D
1

Advertisement

Responsive Ad
46of86