proposal-array-last
proposal-array-last copied to clipboard
What about TypedArray views?
The rationale would seem to apply equally to them.
Good point; anything that is added here to Array.prototype should probably be added to TypedArray.prototype.
PRs always welcome 👍
2 questions: should proposed accessors validate that the target is a typed array and what the behaviour expected for typed arrays with zero length?
@zloirock Is there any reason to do it differently than for Arrays? As far as I can tell, the proposed spec would work for typed arrays without changes… right?
@addaleax almost all typed array methods are non-generic and throws an error on something different from typed array. Typed arrays have a constant length, so setting .lastItem for typed arrays with zero length by the current spec is an error.
If the issue @zloirock brought up is resolved, I can look into submitting a PR to add .lastItem and .lastIndex for TypedArrays.