Reputation: 2565
I have written below code:
<script type="text/javascript">
function testGenerator()
{
yield "first";
document.write("step1");
yield "second";
document.write("step2");
yield "third";
document.write("step3");
}
var g = testGenerator();
document.write(g.next());
document.write(g.next());
</script>
My desired output: step1step2 But the above code show nothing on my html. Could any one help me to figure out what the mistake I have done here.
Thanks
Upvotes: 0
Views: 1301
Reputation: 29941
Generators/iterators are currently only supported by Firefox, and to use them you need to change your script tag's type
attribute to "text/javascript;version=1.7"
.
Upvotes: 2