can ArrayObj.Push("a") return somthing?

Propose new features and changes
aliztori
Posts: 119
Joined: 19 Jul 2022, 12:44

can ArrayObj.Push("a") return somthing?

Post by aliztori » 27 Aug 2023, 11:07

i wish

Code: Select all

ArrayObj.push(args*)
return the own array like

Code: Select all

mapObj.Set(args*)

lexikos
Posts: 9688
Joined: 30 Sep 2013, 04:07
Contact:

Re: can ArrayObj.Push("a") return somthing?

Post by lexikos » 28 Aug 2023, 02:29

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.

Post Reply

Return to “Wish List”