All of my individual components in the code below work perfectly. I have console.logged the loop, if I remove the function call for the second function from the first the numbers do not appear, and the second function returns the numbers joined by a space and a comma. However, my loop does not appear to be working as it only returns one group of numbers.
<html>
<body>
<p>Click the button to display a random number.</p>
<button onclick="pballmultiple()">Try it</button>
<p id="demo"></p>
<script>
function pballmultiple() {
for (var j = 0; j < 5; j++) {
pballnumbers();
}
}
function pballnumbers() {
var pballnums =[];
for (var i = 0; i < 5; i++) {
var randomNumber= Math.floor(Math.random() * 69)+1;
pballnums.push(randomNumber);
document.getElementById("demo").innerHTML = pballnums.join(" - ");
}
}
![Index|450x500](upload://48m3vndgS9VUTxIMsel4BUI1R4u.png)
</script>
</body>
</html>