function bubbleHover() { for (var e = document.querySelectorAll('circle'), t = 0; t < e.length; t++) { e[t].addEventListener('mouseover', function () { fillColor(this) }) } } function fillColor(e) { e.setAttribute('style', 'fill:' + colors[Math.floor(Math.random() * colors.length)]) }