Kod
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<style>
#flex {
display: flex;
justify-content: space-between;
}
</style>
</head>
<body>
<div id="flex">
<div id="num0"></div>
<div id="num1"></div>
<div id="num2"></div>
<div id="num3"></div>
<div id="num4"></div>
</div>
<br>
<h4>Winner:</h4>
<div id="win"></div>
<script>
let tab = new Array
let tabColor = new Array
function randomColor() {
let letters = '0123456789ABCDEF';
let color = '#';
for (let i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
}
for (let i = 0; i < 5; i++) {
tab[i] = Math.floor(Math.random() * 100)
tabColor[i] = `<p style="color: ${randomColor()};">${tab[i]}</p>`
document.getElementById(`num${i}`).innerHTML = tabColor[i]
}
let winRandom = Math.floor(Math.random()*4)
document.getElementById("win").innerHTML = tabColor[winRandom]
</script>
</body>
</html>