JSFiddle - React, Tailwind, and code Playground

by Alan November

HTML

<html>

<body>


<input type = textbox id ="in1">
<input  type = textbox id = "in2">
<input type = button id = calculate onclick = "cal()" value = "calculate">
<p id = "out">

</p>

</body>
</html>

JavaScript

function cal() {
	var str1 = document.getElementById("in1").value;
  var str2 = document.getElementById("in2").value; 
  if (str1 > str2){
  	document.getElementById("out").innerHTML = str1
  }
  else document.getElementById("out").innerHTML = str2;
alert(typeof str2)
}