Is it possible, in Javascript, to create an array whose length is guaranteed to remain the same?
For example, the array A
is created with length 2. Subs
I've written a array-fixed https://github.com/MatrixAI/js-array-fixed which is a library providing you with fixed length arrays and fixed length dense arrays (arrays which always has its elements collapsed left or collapsed right).
It supports many standard array operations such as splice and slice. But more operations can be added in the future.
The concept of push
doesn't make sense, instead there is caret*
methods available that insert an element and push out elements that already exist into empty slots.