Async/Await is not working with node 4.x. Can i have the alternate?

后端 未结 3 1616
走了就别回头了
走了就别回头了 2021-01-27 21:39

Getting below error when i try to use async/await with NodeJs 4.x. Any issue with the below sample code or should i use alternate ?

async function main ()

3条回答
  •  梦如初夏
    2021-01-27 22:14

    try installing asyncawait. It should work for older node versions. Other alternatives are using a callback or promises.

    you'll have to require it

    1. npm install asyncawait

    2. require modules.

      var async = require('asyncawait/async');

      var await = require('asyncawait/await');

    3. perform operations.

      (async function () { const intgetIDvalue = await fntest(getID); })();

提交回复
热议问题