Filter by a keyword — keep only users whose name contains "ch" (case-insensitive)
Log each matching user's name and email
PRACTICE 12: Filter by name keyword
📄 p12-search.js
Ln 1, Col 1JavaScript
💻 Console Output:
Hint:
Use user.name.toLowerCase().includes(k) as the filter condition.
Problem 13 of 20
🟡 Medium
Axios POST — Create a Comment
Your Task:
Use axios.post() to create a new comment on post 1
The body should include: postId, name, email, body
Log the full response object that comes back
PRACTICE 13: Axios POST – comment
📄 p13-axios-post.js
Ln 1, Col 1JavaScript
💻 Console Output:
Hint:
Axios syntax: axios.post(url, bodyObject). The response data is at response.data. No need to call JSON.stringify() — Axios handles that.
Problem 14 of 20
🟡 Medium
Three-Step Chain — Post → Comments → Count
Your Task:
Fetch post #3
Then fetch all comments for that post: /comments?postId=<id>
Log the post title, and how many comments it has
Also log the email of the first commenter
PRACTICE 14: 3-step chain
📄 p14-three-chain.js
Ln 1, Col 1JavaScript
💻 Console Output:
Problem 15 of 20
🟡 Medium
Promise Chain (no async/await)
Your Task:
Fetch user #5 using only.then() and .catch() — no async/await
In the first .then(), check response.ok and call response.json()
In the second .then(), log the user's name and company name (user.company.name)
PRACTICE 15: Pure .then() chain
📄 p15-then-chain.js
Ln 1, Col 1JavaScript
💻 Console Output:
Problem 16 of 20
🔴 Medium-Hard
Reusable Helper + User Albums
Your Task:
Write a reusable fetchJson(url) async helper function
Use it to: fetch user #1, then fetch all albums for that user (/albums?userId=<id>)
Log the user's name, total albums, and the title of every album
PRACTICE 16: Custom helper + chained data
📄 p16-helper.js
Ln 1, Col 1JavaScript
💻 Console Output:
No hints. You have all the pieces from the earlier problems. Put them together.
Problem 17 of 20
🔴 Medium-Hard
Parallel Requests with Promise.all
Your Task:
Fetch users #1 and #2 at the same time using Promise.all()
Only after both resolve, log both users' names side by side
Add error handling — if either fails, log the error
PRACTICE 17: Promise.all – parallel fetches
📄 p17-parallel.js
Ln 1, Col 1JavaScript
💻 Console Output:
Problem 18 of 20
🔴 Medium-Hard
Full Pipeline — User → Posts → Comments
Your Task:
Fetch user #1
Then fetch all posts by that user
Then, for the first post only, fetch its comments
Log: user name, first post title, comment count, and all commenter emails
PRACTICE 18: 3-resource pipeline
📄 p18-pipeline.js
Ln 1, Col 1JavaScript
💻 Console Output:
Problem 19 of 20
🔴 Medium-Hard
POST then Verify — Create & Echo
Your Task:
Create a new post using a POST request
Log the id returned by the server
Then immediately make a second GET request to /posts/1 to read an existing post
Log both: "Created ID" from the POST, and "Verified title" from the GET
All of this inside one async function with proper error handling
PRACTICE 19: POST then GET
📄 p19-post-then-get.js
Ln 1, Col 1JavaScript
💻 Console Output:
Problem 20 of 20
🔴 Medium-Hard
Graceful Error Handling + Retry
Your Task:
Write an async function fetchWithRetry(url, retries)
It should try to fetch the URL up to retries times
If a fetch attempt throws, log "Attempt N failed" and try again
If all attempts fail, log "All attempts failed"
Test it by calling it with a bad URL first, then with a good one
PRACTICE 20: Retry logic
📄 p20-retry.js
Ln 1, Col 1JavaScript
💻 Console Output:
Challenge:
The fake API returns 200 even for unknown resources. Use if (!res.ok) throw new Error(...) inside your loop to force a real failure, then test with a valid endpoint to confirm success.