I have a working code which define two const with js and then multiply those two const to get third value. But what I need is to add zeroes in the end of the values and I need help with that:
<p> Total odd: <span id = "totaleur_id"> </span> </p>
<p> Stake: <span id = "steur_id"> </span> </p>
<p> Return: <span id = "posseur_id"> </span> </p>
<script>
const totaleur = 1.80
const steur = 50
const possibleWinnings = totaleur * steur
document.querySelector("#totaleur_id").textContent = totaleur;
document.querySelector("#steur_id").textContent = steur;
document.querySelector("#posseur_id").textContent = possibleWinnings;
</script>
What I get as an frontend result is:
Total odd: 1.8
Stake: 50
Return: 90
But I need the result to be:
Total odd: 1.80
Stake: 50
Return: 90.00
And other frontend result example:
Total odd: 2.35
Stake: 50
Return: 117.5 //this should be: 117.50