for await...of

A loop that awaits and visits values from an async iterable.

What is for await...of in JavaScript?

for await...of — A loop that awaits and visits values from an async iterable.

async function readMessages(messages) {
    for await (const message of messages) {
        saveMessage(message);
    }
}

Level: Freelancer · More JavaScript terms at this level

Updated