最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - async function declaration expects ';' in Internet Explorer - Stack Overflow

programmeradmin6浏览0评论

I have an async function declaration that works on Chrome and Firefox, but gives the following error in internet explorer.

SCRIPT1004: Expected ';'

File: javascriptFile.js, Line: 5, Column 7

This is the simplified version with these two function at the top of the file, and it still fails on internet explorer.

function sleep (ms) {
  return new Promise(function (resolve) { setTimeout(resolve, ms) })
}

async function begging (help) {
  await sleep(1000)
  console.log('please')
}

I can not seem to find anything about not being able to declare async functions in internet explorer. I would really appreciate any help at all, I'm not sure where to look next in order to figure this out.

I have an async function declaration that works on Chrome and Firefox, but gives the following error in internet explorer.

SCRIPT1004: Expected ';'

File: javascriptFile.js, Line: 5, Column 7

This is the simplified version with these two function at the top of the file, and it still fails on internet explorer.

function sleep (ms) {
  return new Promise(function (resolve) { setTimeout(resolve, ms) })
}

async function begging (help) {
  await sleep(1000)
  console.log('please')
}

I can not seem to find anything about not being able to declare async functions in internet explorer. I would really appreciate any help at all, I'm not sure where to look next in order to figure this out.

Share asked Aug 14, 2017 at 19:01 Struggle_BusStruggle_Bus 231 silver badge3 bronze badges 0
Add a ment  | 

1 Answer 1

Reset to default 8

Internet Explorer does not support async functions, and never natively will. The main drawback of using new JavaScript features is lack of support.

发布评论

评论列表(0)

  1. 暂无评论