Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
NotificationsYou must be signed in to change notification settings

coding-in-public/vanilla-javascript-challenges

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Here goes the short description of the challenge...

constBASEURL="https://dummyjson.com";

See API Documentation for help →https://dummyjson.com/docs/


use the/products endpoint for (1 – 4)

  1. Create a fetch function calledcustomFetch that hits the"https://dummyjson.com/products" endpoint and console logs and returns the data.
  2. Update thecustomFetch function to take in a endpoint and handle errors (including a wrong endpoint).
  3. Create a function calledgetProducts that returns all the products in an array. Then list all the products in the DOM in an unordered list.
  4. Update thecustomFetch function to handle a delete, add, or update a request.
    • Use the updated function to update and then delete a product by it’s ID. (FYI,"https://dummyjson.com/products/1" will access the product with the id of 1).
    • Use the updated function to POST a new product to the list of products. (FYI,"https://dummyjson.com/products/add" will allow POST requests).

use the/users,/posts/, and/comments endpoints for (5 – 7)

  1. Create a function calledgetFilteredUsers that console logs and returns all the users who are 21 years old in a new array of objects in the following structure:
[{name:"John Doe",(containingfirstandlastname)age:21,email:"email@email.com",},  ...]

See help documentation for help athttps://dummyjson.com/docs/users. You can use thecustomFetch function you created earlier.

  1. Alter thegetFilteredUsers function to return all filtered users in an object with the id as the key and the user object as the value. (See help documentation for help athttps://dummyjson.com/docs/users)

  2. Create a new function calledgetCommentsOnUsersPosts that takes in a user id and returns all comments on any post by that user in an array of objects. Each object should contain two properties,postTitle andcomments. Comments should contain theuserID of the commentor and thetext. Bonus points for filtering out posts without comments. Sample below:

[{postTitle:"Post Title",comments:[{userId:1,text:"Comment Text"},{userId:2,text:"Comment Again"}]},  ...]

Seehttps://dummyjson.com/docs/users,https://dummyjson.com/docs/posts, andhttps://dummyjson.com/docs/comments for help.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp