How to solve the problem when using Babel to convert es6 code to es5 and then generator function reports an error in the browser?

the code in es6 wants to print an error

function* add(){
    yield "hello";
    yield "world";
    return "encoding";
}
let ad=add();
console.log(ad.next())
console.log(ad.next())
console.log(ad.next());
console.log(1)
May.16,2022

Babel does not translate all the new features of ES6 into ES5 code, and generator is one of them that cannot. The reason is here: https://www.zhihu.com/questio...
to achieve your goal, you need to introduce additional polyfill, take a look at babel-dplyfill . But generally speaking, polyfill is large and requires a trade-off.

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-1b30fd9-2bd55.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-1b30fd9-2bd55.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?