Revision of Map
Lets take an array
const products = [
{id: 1, name: "Laptop", price: 80000, isAvailable: true},
{id: 2, name: "TV", price: 50000, isAvailable: true},
{id: 3, name: "Watch", price: 5000, isAvailable: false},
{id: 4, name: "Phone", price: 40000, isAvailable: true},
];
Extract only name of products using map.
Extract only price of products using map.
Extract only name and price using map.
Convert all names to uppercase
Add a new property price after discount where discount is 10% of MP. (better use spread operator).
Add a new property category and its value must be “budget” if it is less than or equal to 40000 and “premium” if more. (spread operator)
Add an new property named inStock with its value equal to isAvailable (better use spread operator).
Add a new property named priceWithTax whose value if 20% of MP. (spread operator)
Filter exercises