Final Project: JSON Product Catalog
Time to combine everything: parsing JSON, building DOM elements, and keeping data in sync with what's on the page.
Requirements
- Start from a JSON array of at least 6 products, each with
id,name,price, andinStock. - Render every product as a card in the DOM (name, price, and an in/out of stock badge) using
createElement, not by writing raw HTML strings. - Add a search input that filters the rendered cards as the user types, matching on product name.
- Let the user toggle a product's
inStockstate by clicking a button on its card. - Persist the current product list to
localStorageas JSON every time it changes, usingJSON.stringify, and load it back withJSON.parseon page load if it's there.
Stretch goals
- Add a form to add a brand-new product.
- Sort products by price, ascending or descending.
- Show a running count of how many products are currently in stock.
Submit your repository link below when you are done, an instructor will review it before you can mark this lesson complete. Good luck! 🚀