Day 5: Objects & Week 4 Mini-Project
Daily Objective
Section titled “Daily Objective”Master JavaScript objects and build a product catalog with filtering, sorting, and total calculations.
1. Object Fundamentals
Section titled “1. Object Fundamentals”const product = { id: 101, name: 'Wireless Mouse', price: 29.99, inStock: true, applyDiscount(percent) { this.price -= this.price * (percent / 100); }};
console.log(product.name);console.log(Object.keys(product));Week 4 Mini-Project: Product Inventory Manager
Section titled “Week 4 Mini-Project: Product Inventory Manager”Project Requirements:
- Create an array of product objects (each with
id,name,category,price, andinStock). - Use
filterto isolate in-stock items under $50. - Use
sortto sort remaining products alphabetically by name. - Use
reduceto compute the grand total inventory value.