proposal-array-last icon indicating copy to clipboard operation
proposal-array-last copied to clipboard

item() proposal does not substitute this proposal

Open drpicox opened this issue 5 years ago • 1 comments

Although it seems that:

const last = array.lastItem;
const last = array.item(-1);

both are equivalent, they are not:

array.lastItem = newValue;
array.item(-1) = newValue; // it does not make sense

the assignation is not part of the .item() proposal.

I have seen in the issues of this proposal interesting alternatives like:

  • #28 array[ ^n]
  • #23 array.get & array.set

See https://github.com/tc39/proposal-item-method/issues/16 for the mirroring of this issue.

drpicox avatar Aug 05 '20 08:08 drpicox

I'm not sure assignment has a convincing enough use case to warrant being specced. See https://github.com/tc39/proposal-array-last/issues/16

keithamus avatar Aug 05 '20 08:08 keithamus