PZR's coin flip probabilitiesationizer

For future reference:

The javascript side:

function getRandomInt(max) {
  return Math.floor(Math.random() * max);
}

var heads = 0; //Here will be all heads of the 10,000,000 flips
var tailHeavyHeads = 0; //Here will be all heads whenever every previous total flips results in any amount more tails than heads, which we will refer to as tails heavy
var tailHeavyTails = 0; //Here will be all tails whenever every previous total flips results in any amount more tails than heads, which we will refer to as tails heavy
var flipcount = 0; //Here will be the total flip count

function flip() {
  // value will be random number of 0 or 1
	const value = getRandomInt(2);
  // console.log(value);
  
  if ((flipcount / heads) > 2) {
  // multiplying total previous flips by total previous heads gives 	more than 2, meaning there were more tails than heads
    if (value) { 
    //There was a head, a 1
       tailHeavyHeads += 1;
    } else {
    //There was a tail, a 0
       tailHeavyTails += 1;
    }
  }
  
  
  if (value) {
  	// it's 1, so that means it's heads
    heads += 1;
  } 
}

for (let i = 0; i < 10000000; i++) {
   flip();
   flipcount += 1;
}

$('.imbalanceheads').val(tailHeavyHeads);
$('.heads').val(heads);
$('.pc_imbalanceheads').val(tailHeavyHeads / (tailHeavyHeads + tailHeavyTails) * 100);
$('.pc_heads').val(heads/ flipcount * 100);
$('.tails').val(flipcount - heads);
$('.imbalancetails').val(tailHeavyTails);
$('.pc_imbalancetails').val(tailHeavyTails / (tailHeavyHeads+ tailHeavyTails) * 100);
$('.pc_tails').val(100 - (heads / flipcount * 100))

The HTML side

<span>total heads</span><input type="text" class="heads">
<br>
<span>tail heavy heads</span><input type="text" class="imbalanceheads">
<br>
<span>% total heads</span><input type="text" class="pc_heads">
<br>
<span>% tail heavy heads</span><input type="text" class="pc_imbalanceheads">
<br>
<span>total tails</span><input type="text" class="tails">
<br>
<span>tail heavy tails</span><input type="text" class="imbalancetails">
<br>
<span>% total tails</span><input type="text" class="pc_tails">
<br>
<span>% tail heavy tails</span><input type="text" class="pc_imbalancetails">

This program is designed to test whether coin flips are likelier to land heads if the flip series preceding them have more tails than heads.

Thanks.