title: Creating a simple inventory system in JavaScript
body: <p>I'm trying to make a simple text adventure/farming simulator, but I'm new to JavaScript and I'm stuck trying to plan out how my inventory system will work.  The main problem I have is that there are two main types of items: food/consumables and tools/durable goods.  Food will be created and consumed at a regular rate, whereas tools will need to be bought, and lose durability with each use.</p>
  
  <p>The simplest solution I could think of was to have the quantity of each food item to be a property of the player (player.meat, player.vegetable, etc.) since quantity would be the only thing changing.  Tools were a little more complex, so I figured I could create a Tool prototype, then give the player an inventory array that would store all their tools.  However the more I thought about it, the more I realized food would need to be a prototype as well (it has properties like price and nutritional value as well).</p>
  
  <p>My head is kind of spinning right now trying to think of the most effective way of doing this.  Do I create 2 separate prototypes, then give the player an array for each of them?  Would I need to create a prototype for the array so it can keep track of both item type and quantity?  And will I need to search for each item in the array when I want to modify it?  This seems needlessly complicated, but I can't really think of anything simpler.  Can anyone help?</p>