JSFiddle - React, Tailwind, and code Playground

by Yisroel Meir Blumstein

HTML

<!DOCTYPE html>
<html>

  <head></head>

  <body onload="foo()">

    Hello

    <div id="foo">foo</div>


  </body>

</html>

JavaScript

function bar() {

  let x = Math.random() * 6 + 1;

  let y = Math.random() * 6 + 1;
  x = Math.round(x);
  y = Math.round(y);

  let z = (x * y) % 10;

 // let e = document.getElementById("foo");



  //e.innerText = x.toString();

  //console.log("DONE");

  return z;
}


function foo() {

  let arr = new Array(10);
  arr.map(x => {x=0;});

  for (let i = 0; i < 100 ;i++) {


    let z = bar();

    arr[z]++;


  }

  let e = document.getElementById("foo");

  e.innerText = arr;
  
  console.log(arr);

}