Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: remove the return await #3343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
xgqfrms wants to merge 1 commit into javascript-tutorial:master from xgqfrms:patch-1
Closed

fix: remove the return await #3343

xgqfrms wants to merge 1 commit into javascript-tutorial:master from xgqfrms:patch-1

Conversation

@xgqfrms
Copy link

@xgqfrms xgqfrms commented Jan 29, 2023
edited
Loading

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
Copy link

CLAassistant commented Jan 29, 2023
edited
Loading

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

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /