<script> let arr = [0,0,0,0,0,0,0,0,0,0]; //input number DOM object let input = document.querySelector("#input_number"); let num = Number(input.value); function RepeatNtimes() { for(let i =0; i<=num;i++) { // Clear array arr = []; CountIndex(); } } function CountIndex() { for(let j = 0;j<=num;j++) { let rand = Math.floor(Math.random()*10); arr[rand]++; document.querySelector("#re").innerHTML = `${j} appearance is: ${arr[j]} <br>`; } } </script>
num
RepeatNtimes
CountIndex
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)