const bubbles = document.querySelectorAll('.bubble') console.log(bubbles) let colors = ["--blue","--pink","--orange","--yellow","--green"]; Array.from(bubbles).forEach(bubble=>{ let color = colors[(colors.length * Math.random()) | 0]; bubble.style.backgroundColor = `var(${color})`; bubble.style.transform = `rotate(${Math.random() * 10 - 5}deg)` })