Спасибо, уже нашла решение)
<p id="mini"></p>
<div class="flex">
<div class="shape square"></div>
<div class="shape circle"></div>
<div class="shape oval"></div>
</div>
<div id="foo"> Click</div>
$("#foo").click(function () {
var colors = [
'green',
'red',
'blue'
];
var divs = [
'square',
'circle',
'oval'
];
function compareRandom() {
return Math.random() - 0.5;
}
colors.sort(compareRandom);
divs.sort(compareRandom);
document.getElementsByClassName(divs[0])[0].style.backgroundColor = colors[0];
document.getElementsByClassName(divs[1])[0].style.backgroundColor = colors[1];
document.getElementsByClassName(divs[2])[0].style.backgroundColor = colors[2];
var r_class = divs[Math.floor(Math.random() * divs.length)];
var r_color = colors[Math.floor(Math.random() * colors.length)];
document.getElementById("mini").innerHTML = "Select " + document.getElementsByClassName(r_class)[0].style.backgroundColor + " " + r_class;
document.getElementById("mini").style.color = r_color;
$(".shape").click(function () {
if (this.style.backgroundColor == document.getElementsByClassName(r_class)[0].style.backgroundColor && ) {
alert("yep");
} else {
alert("no");
}
})
});