-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerators.html
More file actions
42 lines (41 loc) · 1.15 KB
/
generators.html
File metadata and controls
42 lines (41 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.29/browser.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.29/browser-polyfill.js"></script>
<script type="text/babel">
function* toto() {
let a = 10;
let b = 15;
console.log(a + b);
yield;
console.log("pas atteint à la première execution")
yield;
console.log("fini !");
}
let totoIterator = toto()
totoIterator.next();
totoIterator.next();
totoIterator.next();
function* takeOff() {
yield "trois";
yield "deux";
yield "un";
yield "zéro";
yield "décollage";
}
var toItr = takeOff();
var handle = setInterval(function () {
var instruction = toItr.next();
if (instruction.done) {
clearInterval(handle)
} else {
console.log(instruction);
}
}, 1000)
</script>
<title>ES6 via babel</title>
</head>
<body>
</body>
</html>