JSFiddle - React, Tailwind, and code Playground

HTML

Premier chiffre : <p id="un"></p> <input type="button" id="bouton" value="choisir" onClick="choix()" /><br/>

Second chiffre : <p id="deux"></p><input type="button" id="bouton2" value="changer" onClick="change()" /><br/>
<div id="trois"></div>

JavaScript

var uno;
var testi;
var testf;
function choix(){
	toto=true;
	while(toto){
		uno=prompt("donnez un chiffre entre 1 et 5");
		uno=parseInt(uno);
		if(uno>=1 && uno<=5){
			toto=false;
		}
	}
	document.getElementById("un").innerHTML = uno;
    chekcIfEqual(uno,testf);
}
function change(){ 
	testi=Math.floor ( Math.random() * 5 );
	testf=testi+1;
	document.getElementById("deux").innerHTML = testf;
    chekcIfEqual(uno,testf);
}
function chekcIfEqual(a,b){
    if(a == b){
	    document.getElementById("trois").innerHTML = "ce sont bien les mêmes chiffres";        
    }else{
        document.getElementById("trois").innerHTML = "nop";
    }
}