var initialCircle;
var i;
var randomXPos;
var randomYPos;
var colorArray;
var interval01;
var circleNodeList;
colorArray=[
'aliceblue','lavender','powderblue','lightblue','lightskyblue','skyblue','deepskyblue','lightsteelblue', 'dodgerblue','cornflowerblue','steelblue','cadetblue','mediumslateblue','slateblue','darkslateblue','royalblue','blue','mediumblue','darkblue','navy','midnightblue','blueviolet', 'indigo'];
var randomColor;
function startBouncingHoverCircles(){interval01 = setInterval(function(){randomXPos = Math.floor(Math.random() * 450) + 1;randomYPos = Math.floor(Math.random() * 300) + 1;randomColor=colorArray[Math.floor(Math.random() * colorArray.length)];initialCircle = document.createElement('div');document.querySelector("#container").appendChild(initialCircle);initialCircle.className="aces";initialCircle.style='height:30px;width:30px;border-;box-sizing:border-box;position:absolute;border:3px solid green;background-color:'+randomColor;initialCircle.style.top=randomYPos+'px';initialCircle.style.left=randomXPos+'px';},1);setTimeout(function(){clearInterval(interval01);colorChange()},200)}
function colorChange(){circleNodeList = document.querySelectorAll(".circles");console.log(circleNodeList.length);for (let i = 0; i < circleNodeList.length; i++) {
circleNodeList[i].style.backgroundColor='red';
}}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/randomcolor/0.6.1/randomColor.min.js" integrity="sha512-vPeZ7JCboHcfpqSx5ZD+/jpEhS4JpXxfz9orSvAPPj0EKUVShU2tgy7XkU+oujBJKnWmu4hU7r9MMQNWPfXsYw==" crossorigin="anonymous"></script>
<style>#container {
width: 450px;
height: 300px;
position: relative;
border: 1px solid black;
margin: auto;
}</style>
</head>
<body>
<button onClick="startBouncingHoverCircles()">Start</button>
<div id="container"></div>
<script src="../Js/bouncingHoverCircles.js"></script>
</body>
</html>
question from:
https://stackoverflow.com/questions/65941035/how-is-it-when-i-use-queryselectorall-that-i-am-getting-undefined