| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Operators/async_function* | [Back] [Original] |
Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
This feature is well established and works across many devices and browser versions. Its been available across browsers since 2020 1.
async function* .
async function* foo() {
yield await Promise.resolve("a");
yield await Promise.resolve("b");
yield await Promise.resolve("c");
}
let str = "";
async function generate() {
for await (const val of foo()) {
str = str + val;
}
console.log(str);
}
generate();
// Expected output: "abc"
async function* (param0) {
statements
}
async function* (param0, param1) {
statements
}
async function* (param0, param1, /* ,*/ paramN) {
statements
}
async function* name(param0) {
statements
}
async function* name(param0, param1) {
statements
}
async function* name(param0, param1, /* ,*/ paramN) {
statements
}
name Optional. . .
paramN Optional. 255 .
statements Optional.
async function* async function* statement . , async function* . .
x , .
const x = async function* (y) {
yield Promise.resolve(y * y);
};
x(6)
.next()
.then((res) => console.log(res.value)); // 36
| Specification |
|---|
| ECMAScript 2027 LanguageSpecification # sec-async-generator-function-definitions |
async function* statementAsyncGeneratorFunction objectGeneratorFunction objectyieldyield*Function objectThis page was last modified on 2025 2 11 by MDN contributors.
Your blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |