When mm.subMaterials is “set” (given members), a special func called ._hookArray() is called.
Scroll down to line 57 area, and we see line 59 installing a CUSTOM .push() method onto that array.
Scroll down to line 68, and we see a custom .splice() method installed, too. Those two custom Array-class methods… are what you are seeing.
Now, as-for WHY that was done/needed, I dunno. Possibly, it is because the author wanted to “insert” an automatic call to this._markAllSubMeshesAsTexturesDirty(); whenever anyone used push() or splice()… on a mm.subMaterials array.
Stay tuned for more comments about that, if you need more info.
Thank you, @Wingnut for help, but i anyway dont understand why with submaterials ( we wait array with submaterials) we get some functions to in this array. Perhaps bug? Look at 22 - return only array with mat. Mystic…
Not true. The custom push() and splice() are not inside the array’s “data storage tank”.
Did you test it? https://www.babylonjs-playground.com/#2Q4S2S#53 Lines 43-45… standard iteration… returns 3 items, not 5. console.log(multimat.subMaterials.length) returns 3, not 5. It is acting exactly like any other JS Array-class object.
For YOUR purposes… I think you can simply ignore the existence of the custom push and splice. Just pretend it is a standard array.
Array objects have MANY methods… but most of them are not shown to us when we “dump” the array to console (unless you click-on the grayed-out __proto__: Array  link at the bottom of the console dump).
If you ask WHY those two custom funcs are shown to us… when we dump the array to console… that I do not know.
Speculation: Normally, you can see ALL the methods on the Array-class object… by looking at its “prototype” layer. When author installed these custom funcs, they were installed “above” the prototype layer, and therefore… those 2 funcs are shown to us… with a standard dump. That’s just a theory of mine, and is not backed-up by any knowledge of prototypes.
Perhaps others will comment, soon. I’m not sure that I am answering well. Did you want @Deltakosh or others who are JS pro… to comment? I’m sure they would be glad to do so.
In general, you need-not be concerned that it is a custom array. It will have near-identical functionality as any other array.
Are the custom functions conflicting-with your scene coding, somehow? (other than showing their names in the console dump). If so, tell us how.
Ok, I understood (I thought I understood prototyping in JS, but now I’m not sure)
In any case, I think that the user of the engine can wait for other results for the iterator “in”), maybe I will understand this later.