Questions about the es6 generator

problem description

clipboard.png

clipboard.png

calls throw after the first next (). Why is the console.log (1) in figure 1 not executed? the console.log ("b") in figure 2 is executed.

is because the yield 1; in figure 1 is not surrounded by try, so the generator ends directly. Figure 2 because yield 1 is surrounded by try, so that executing throw will not be treated as a throwing error, does the code continue to go to the next pause yield 2 and return {value: 2, done: false}? Who can explain this more scientifically?

Mar.25,2022

just check the document

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b383cd-40685.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b383cd-40685.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?