I am working on a project for school in which I need to create a web page that simulates the tossing of dice. I've done that. I need to include three <span> tags: the first counting the number times I click "roll", the second counting the number of times I roll doubles, and the third being the percentage of times I have rolled doubles in regards to my overall rolling. I have done the first two easily but I'm struggling with the third <span> tag. Here's what I've done so far:
And in the <body>:
I'm having trouble getting a value to show up in this span tag. What am I doing wrong?
var numOfRolls = parseInt(document.getElementById('rollSpan').innerHTML);
var numOfDoubles = parseInt(document.getElementById('doubleSpan').innerHTML);
var num = parseInt('numOfDoubles' / 'numOfRolls');
var percentDoubles = num.toFixed(2);
And in the <body>:
<span id="percentSpan">0.0</span> % of your rolls are doubles.
I'm having trouble getting a value to show up in this span tag. What am I doing wrong?


