3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

await hoge() SyntaxError: Unexpected identifier

Last updated at Posted at 2017-11-13
/file.js:3
    let fuga = await hoge.fuga();
                     ^^^^
SyntaxError: Unexpected identifier

大抵asyncを忘れている。


browser.on('click', hoge => { // ←短いアロー関数式書けていい気になってasync忘れている
  // console.log(hoge) // ←だいたい最初はawait不要なもので動作確認している
  let fuga = await hoge.fuga(); // 本命コード書き始めて慌てる
})

async付けても()の省略は出来る。

browser.on('click', async hoge => { // async付けましょう
  let fuga = await hoge.fuga();
})
3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?