title: How do i convert "[object Object]" to a number
body: <p>I have been set a task, using an external IFFE file, to create an app that works out the cost of fuel for a fleet of cars using the functions inside the IFFE. Then display it in a box.</p>
  
  <p>The IFFE can be see <a href="http://jack-stiles-online.co.uk/js/fuelCalculator.js" rel="nofollow">Here</a>, i have been told by the people that set me the task that the following code should work to call the correct function</p>
  
  <pre><code>var fuel = new fuelCalc();
  
  
  // On the button press
  miles = 10000;
  var cost = fuel.cost(miles);
  </code></pre>
  
  <p>Then doing the following should put it into the text box,</p>
  
  <pre><code>document.getElementById("TotalCost").value = cost;
  </code></pre>
  
  <p>However, all it does is put the following in the text box</p>
  
  <p>[object Object]</p>
  
  <p>What do i need to add to make it show the calculated amount?</p>