6.1.3 Circles in Squares Code HS JavaScript
Repeatedly draw a circle inside of a square and then a square inside that circle and so on. You should repeat this while the size is greater than MIN_SIZE. Each time you draw a shape, it should be centered on the screen and a new random color. You’ll need to update the size based on the size of the previous one.
Hint: The radius of a circle inside a square is half the side length of the square. The side length of a square inside a circle is 2 * radius divided by the square root of 2. You can use Math.sqrt(2) to take the square root.
Be careful not to get into an infinite loop in this program. It may be helpful to solve it with a for loop first to make sure you’re doing it right before attempting using a while loop.