I am practicing XHTML with JavaScript. I want the cost to be in two decimal places, just like how we calculate money in real life. How would I do that? This is my code in the JavaScript file:
function computeCost() {
var french = document.getElementById("french").value;
var hazlenut = document.getElementById("hazlenut").value;
var colombian = document.getElementById("colombian").value;
var regular = document.getElementById("regular").value;
//Compute the cost
document.getElementById("cost").value =
totatCost = french * 3.49 + hazlenut * 3.95 + colombian * 4.59
+ regular * 1.99;
} // end computeCost