So this is my code:
requestList.push(newDrink("Beer 1", 1.2, "Quantity:33cl", 0, "Beer"));
"1.2" is the price. And there's another variable that is initialized with 1 which is the "quantity".
function printtolist()
{
var price = requestList[i].price * requestList[i].quantity;
alert(price);
}
So, pretty easy, and when i add more quantity i print it, so in this case the output should be like this.
1.2
2.4
3.6
4.8
6
7.2
But i'm getting this:
1.2
2.4
3.599999999999996
4.8
6
7.199999999999999
And I can't understand this. Quantity is added with
requestList[i].quantity++
So my variables are like "doubles and ints". Any ideas?