This concerns the p5.js class EggRing example that is accessible through the Processing Development Environment menu via File > Examples… > Objects > ex05_Composite_Objects.

It can also be found online here: Composite Objects.
I have been experimenting with modifying the code from that script for practice. It is actually a great example for practicing with objects, but it does contain some details, discussed below, that I don’t understand, maybe because I am still a beginner.
The transmit method of class EggRing contains this conditional code block that seems to be related to its working with instances of class Ring.:
if (circle.on == false) {
circle.on = true;
}
As written, doesn’t that code attempt to access and create an on property for the global circle function? Perhaps this was intended instead:
if (this.circle.on == false) {
this.circle.on = true;
}
The class Ring does have an on property that is created in its constructor. If that property needs to be accessed and manipulated externally, maybe that class should contain methods for these purposes.
The class Egg contains calls to the push and a pop functions in its display() method so that it can clean up after changes to the environment made by these function calls:
translate(this.x, this.y);
rotate(this.tilt);
scale(this.scalar);
Would it be better if the call to the push function were moved to the first line in that method, so that the eventual call to pop would also clean up after the calls to the noStroke and fill functions? Perhaps, for the purpose of cleaning up afterwards, calls to the push and pop functions could also be added to the beginning and end, respectively, of the display method of class Ring.
Opinions and advice regarding the above would be greatly appreciated.