I think you have misread the code. _scrollAnchorEntity
is never used without the this
object. It’s always this._scrollAnchorEntity.someFunctionName();
Line 16 is in the class’s initialise function that gets called when the script instance is created and is first active. Line 16 is creating a new property of the class instance (this
) called _scrollAnchorEntity
and later use it on line 87.
I would read about objects and properties, it will explain it a lot better than I can: Working with objects - JavaScript | MDN
Yes
Yes
No. Attributes are declared on the class but the data is assigned in properties on a per script instance. So each script instance will have it’s own set of data. Eg with this attribute, the property can be accessed via this.newVariable
in the script.