()
| 7 | |
| 8 | // Fetch posts from API |
| 9 | async function getPosts() { |
| 10 | const res = await fetch( |
| 11 | `https://jsonplaceholder.typicode.com/posts?_limit=${limit}&_page=${page}` |
| 12 | ); |
| 13 | |
| 14 | const data = await res.json(); |
| 15 | |
| 16 | return data; |
| 17 | } |
| 18 | |
| 19 | // Show posts in DOM |
| 20 | async function showPosts() { |