tc39/proposal-relative-indexing-method

Assignability

falsandtru opened this issue · 4 comments

Does .at method have ability to assign a new value like arr.at(-1) = 0? Or can you enable arr.at[-1] = 0?

No, it doesn’t, and no, we can’t; JS doesn’t have “functions return assignable references” as a feature (imo, thankfully).

I think the expected feature is a readable and writable accessor. But this proposal doesn't aim at updating an element via negative index?

Correct, it is only for reading the value.

I see, thanks.