index.js 488 B

1234567891011121314151617
  1. const getBooks = async(n = 1) => {
  2. let books = await fetch(`https://www.googleapis.com/books/v1/volumes?q=quilting=${n}`);
  3. books = await books.json()
  4. return books.items
  5. }
  6. getBooks(1).then(books => console.log(books))
  7. const getFiftyBooks = async() => {
  8. let arrFiftyBooks = [];
  9. for (let i = 1; i <= 5; i++) {
  10. books = await getBooks(i);
  11. arrFiftyBooks.push(...books);
  12. }
  13. return arrFiftyBooks;
  14. }
  15. getFiftyBooks().then(books => console.log(books))