just me wrote: ↑14 Oct 2021, 03:20
Change the method to return the index of the (last) added element like in v1.1, please.
Related
Which way is the right way?
Object.Push in v1 returned the position of the last value, and Array.prototype.push in JavaScript returns the Array.
For chaining method calls, or whatever reason you want it to return the Array, I think it would be better to invent some syntax for invoking one or more properties of an object while returning the object itself as a value (so you don't need temporary variables or to repeat the variable name in many different situations). Then if Push returns the position, you both win.
In any case, both the array and the position of the last value (= the array's length) are simple to produce even if they aren't returned.