Question: This is building a node.js module that is designed to track inventoru for a store. I need it as code. I need the inventory that
This is building a node.js module that is designed to track inventoru for a store. I need it as code.
I need the inventory that exposes the following functionality:
addItem - A function that takes 2 parameters: an item's name and price and tracks it internally.
items - A function that returns a list of items, sorted by price from least expensive to most expensive.
getMostExpensive - Returns an object that contains the item's name and price for the most expensive item that has been added.
getLeastExpensive - Returns an object that contains the item's name and price for the most least expensive item that has been added.
removeItem - Remove an item by name.
getItemByName - Returns an item's name and price by name.
getItemByPrice - Returns an item's name and price by price.
The module should not expose any functions or bariables that would allow the above functions to have the integrityof their data compromised.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
