以下のコードを書きました:
<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>
私の望ましい出力:step1step2 しかし、上記のコードは私のhtmlには何も表示されません。ここで私が犯した間違いを理解するのを手伝ってくれる人はいますか。
ありがとう