Testing a flag flipper

by alexbfree

HTML

<button id='flipper'>
  Flip
  </button>

JavaScript

let flag = "JULIAN";

let flip = function() {
  if (flag == "JULIAN") {
     flag = "JULIA";
  } else {
     flag = "JULIAN";
  }
}

document.getElementById("flipper").addEventListener('click', flip);

let printer = function () {
  console.log(`on poll, the flag is ${flag}`);
}

setInterval(printer,1000);