title: Javascript calculator based on item price and total price
body: <p>I need to make some kind of calculator for trading some items in the game and honestly javascript calculator would be best for me because it can calculate on the go probably.</p>
  
  <p>But i really dont know from where to start.</p>
  
  <p>I need to calculate items in game how much it worth if i get gold for them.</p>
  
  <p>For example someone is giving me 168 gold and i give him items and there are items like helmet, vest, boots, gloves etc...</p>
  
  <p>So the item prices are like this</p>
  
  <pre><code>Vest is 60 gold
  Helmet is 45 gold
  </code></pre>
  
  <p>And as spare change</p>
  
  <pre><code>Tokens 25 gold
  charms 7 gold
  </code></pre>
  
  <p>So if someone want to give me 168 gold he can select in vest or helmet and tokens or charms as spare change</p>
  
  <pre><code>So for 168 gold 
  
  He gets 2 vest and 7 charms
  
  And for example if he wants to exchange 325 gold in helmets he gets
  
  7 helmets and 1 charm.
  </code></pre>
  
  <p>And so on.</p>
  
  <p>Does anyone have idea how complicated this is and from where to start.</p>
  
  <p>Think of it as i am seller in market and someone comes to me telling me he have 100$ and how many chocolates he can get for that.</p>