Skip to content

Conversation

xgqfrms
Copy link

@xgqfrms xgqfrms commented Jan 29, 2023

async function no need to use await as the returned value

test cases

class Waiter {
  async wait() {
    return await Promise.resolve(1);
  }
}

new Waiter().wait().then(console.log);
// 1

class NewWaiter {
  async wait() {
    // no need `await` ✅
    return Promise.resolve(1);
  }
}

new NewWaiter().wait().then(console.log);
// 1

image

refs

https://javascript.info/async-await

async function no need to use await as the returned value
@CLAassistant
Copy link

CLAassistant commented Jan 29, 2023

CLA assistant check
All committers have signed the CLA.

@xgqfrms xgqfrms closed this by deleting the head repository Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants