JSFiddle - React, Tailwind, and code Playground
HTML
<div id="winning"></div>
<div id="my"></div>
CSS
#winning>span{
background-color:yellow;
}
#my>span{
background-color:blue;
color:white;
}
#my>.myok{
background-color:green;
}
b{
display:block;width:30px;
line-height:30px;float:left;
text-align:center;
box-sizing:border-box;
border:1px dotted grey;
}
JavaScript
function numberArray(a,b){
b=[];while(a--)b[a]=a+1;return b
}
function shuffleArray(d,c,b,a){
for(c=d.length-1;c>0;c--){
b=Math.floor(Math.random()*(c+1));
a=d[c];d[c]=d[b];d[b]=a
}
};
var MaxLotteryNumbers=90,
MaxLotteryResults=6;
var a=numberArray(MaxLotteryNumbers),
b=numberArray(MaxLotteryNumbers);
document.body.appendChild(document.createElement('div')).innerHTML='<b>'+a.join('</b><b>')+'</b>';
shuffleArray(a);
shuffleArray(b);
a=a.slice(0,MaxLotteryResults);
b=b.slice(0,MaxLotteryResults);
//a[0]=77;
//b[0]=77;
document.getElementById('winning').innerHTML='<span>'+a.join(' </span><span>')+' </span>';
for(var i=0,k=document.getElementById('my'),howmanycorrect=0;i<MaxLotteryResults;i++){
var span=document.createElement('span');
a.indexOf(b[i])===-1||(span.className='myok',howmanycorrect++);
span.innerHTML=b[i]+' ';
k.appendChild(span);
}
document.body.appendChild(document.createTextNode('You have '+howmanycorrect+' correct number'+(howmanycorrect>1?'s':'')));