It requires to specify the version (1.7).
<body>
<script type="text/javascript; version=1.7">
var i = 0;
var gen = (function() { while(1) { yield i++; } })();
alert(gen.next()); // 0
alert(gen.next()); // 1
alert(gen.next()); // 2
</script>
</body>
I'm a Japanese programmer. I write about C#, Ruby and JavaScript.
<body>
<script type="text/javascript; version=1.7">
var i = 0;
var gen = (function() { while(1) { yield i++; } })();
alert(gen.next()); // 0
alert(gen.next()); // 1
alert(gen.next()); // 2
</script>
</body>
No comments:
Post a Comment