- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are async generator methods in JavaScript?
Async generator functions are the same like generator function. The async generator functions will return an object, whereas an async generator whose methods such as next, throw and return promises for { value, done }, instead returning directly.
Example
Here’s an example from GitHub showing function returning async generator object −
async function* readLines(path) { let file = await fileOpen(path); try { while (!file.EOF) { yield await file.readLine(); } } finally { await file.close(); } }
- Related Articles
- What are async methods in JavaScript?
- What are generator functions in JavaScript?
- What are Async Streams in C# 8.0?
- Async/Await Functions in JavaScript
- What are the Important Array Methods in JavaScript?
- JavaScript Generator
- Explain Generator functions in JavaScript?
- Random color generator in JavaScript
- What are the methods of a boolean object in JavaScript?
- What are the methods of an array object in JavaScript?
- what are the differences between unshift() and push() methods in javascript?
- Random name generator function in JavaScript
- What are methods in Java?
- What are defender methods or virtual methods in Java?
- How to run functions iteratively with async await in JavaScript?

Advertisements