Asynchronous JS Assignment– 4
Basic Questions
- Write a fetch request to get posts from https://jsonplaceholder.typicode.com/posts and log only the titles.
- Use fetch to get comments from an API and filter comments with email ending in .org.
- Write a fetch request that retrieves users and maps them into an array of names only.
- Fetch todos from the API and log only those with completed: true.
- Write code to fetch photos and display the first 10 thumbnailUrl.
- Use fetch to get data and transform it into a key-value object using reduce.
- Write a fetch request that gets posts and counts how many posts each user has.
- Fetch data from API and log the total number of objects received.
- Fetch users and log the names sorted alphabetically.
- Fetch posts and log the title of the longest post.
- Fetch todos and calculate the percentage of completed tasks.
- Write a fetch request to retrieve albums and group them by userId.
- Fetch posts and log the top 3 longest titles.
- Fetch users and log only users who live in a specific city.
- Fetch comments and log all emails in uppercase.
- Fetch posts and count how many titles contain more than 5 words.
- Fetch todos and separate them into completed and pending arrays.
- Fetch users and print their name and company.name together.
- Fetch comments and log all unique email domains.
- Fetch albums and log album IDs where the title contains the word accusamus
Intermediate Questions
- Write a POST request with fetch to create a new user with {name, email} and log the created ID.
- Use fetch to PUT (update) the title of post id=1.
- Use fetch to DELETE a post with id=1 and log success/failure.
- Send form data using fetch and log the server response.
- Write code to make two fetch requests (posts + users) and combine them into a single array with {userName, postTitle}.
- Use fetch with Promise.all to get posts, users, and comments simultaneously.
- Write a fetch function that retries 3 times if the request fails.
- Fetch posts and paginate them (5 per page) using async-await.
- Fetch photos and save only URLs ending with .jpg.
- Write code to fetch posts and limit response to first 5 results using query params.
- Fetch comments and group them by postId.
- Fetch posts and display word frequency across all titles.
- Fetch data and handle timeout if it takes more than 3 seconds.
- Write code to fetch nested JSON and safely access user.address.city.
- Use fetch to download a text file and display the number of words in it.
- Write a fetch request that uploads a JSON file using FormData.
- Fetch users and log only those with geo.lat greater than 0.
- Fetch todos and create a map of userId → totalTasks.
- Fetch albums and log only unique album titles.
- Write code to fetch comments and replace every vowel in body with *.
Advanced Questions
- Implement a fetch wrapper that always logs request time and response size.
- Fetch paginated API data until no more pages are left, and merge all results.
- Write code to download a large file using fetch with ReadableStream and count chunks.
- Fetch posts and comments, merge them so each post contains its related comments.
- Implement a fetch request with exponential backoff retries (1s, 2s, 4s…).
- Use fetch with AbortController to cancel request if it takes more than 2 seconds.
- Write a fetch function that standardizes error responses into {status, message}.
- Fetch two APIs (users + todos) and log only completed tasks with user names.
- Implement a batch fetcher that makes 10 requests concurrently but processes them sequentially.
- Write a microservice simulation: one fetch gets user IDs, another fetch gets posts for those IDs, and combine them into one dataset.