score:0

Accepted answer

As Lars suggested,

.data(cars)

would cause a new circle to be drawn in each car every time the addCar function was called.

I found that by using:

.data(cars[cars.length - 1].passengers)

to only select the newest car, I was able to draw only the newest circle.


Related Query

More Query from same tag