proposal-array-last
proposal-array-last copied to clipboard
item() proposal does not substitute this proposal
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.
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