JSFiddle - React, Tailwind, and code Playground

by Patel1327

HTML

<button onclick="test()">
start
</button>
<p id="num1"></p>
<p id="num2"></p>
<p id="num3"></p>

JavaScript

function test() {
  var divide;
  var divisor;
  
  divide = prompt("Give me a dividend");
  divisor = prompt("Give me a divisor");
  document.getElementById("num1").innerHTML = "The remainder when " + divide + " is dividend by " + divisor + " is " + modExample(divide, divisor);
	checkDivisibility(divide);

  }
 
  var length;
  
  length = x.length;
  if (x.substring(length-1)%4==0){
  	document.getElementById("num2").innerHTML = x + " is divisible by 4";
  } else {
  	document.getElementById("num2").innerHTML = x + " is not divisible by 4";
  }
  if (x.substring(length-2)%8==0){
  	document.getElementById("num3").innerHTML = x + " is divisible by 8";
  } else {
  	document.getElementById("num3").innerHTML = x + " is not divisible by 8";
  
}