JSFiddle - React, Tailwind, and code Playground
HTML
<button id="generate">Match</button>
<output id="output"></output>
CSS
output {
display: block;
}
JavaScript
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
document.getElementById('generate').addEventListener('click', function() {
var num1 = getRandomInt(1, 3);
var num2 = getRandomInt(1, 3);
var output = (num1 === num2 ? 'Both numbers are the same' : 'Both numbers are different'); document.getElementById('output').innerHTML = output;
});