1234567891011121314151617 |
- const getBooks = async(n = 1) => {
- let books = await fetch(`https://www.googleapis.com/books/v1/volumes?q=quilting=${n}`);
- books = await books.json()
- return books.items
- }
- getBooks(1).then(books => console.log(books))
- const getFiftyBooks = async() => {
- let arrFiftyBooks = [];
- for (let i = 1; i <= 5; i++) {
- books = await getBooks(i);
- arrFiftyBooks.push(...books);
- }
- return arrFiftyBooks;
- }
- getFiftyBooks().then(books => console.log(books))
|