Need help creating a custom object type that performs a reverse shallow copy? For example:
arrayobj.slice(0)
returns a new array object with the same length but each index maintains a reference to the object found at the same index of the original arrayobj. So no duplicate objects
jQuery's extend or for (....) { arr[i] = deepcopy(arr[i]); }
returns a new array object with the same length and each index of this new array holds a new/duplicate object that has the same key/values as the object at the same index of the original arrayobj.
Can you help me create construct that can return a reference to the same array container but in each slot is a new/duplicate object? Ideally can force mutation restrictions disallowing push/unshift/pop/reverse/shift/sort/splice
However, one key difference between Arrays and Array-like Objects is that Array-like objects inherit from Object.prototype instead of Array.prototype. This means that Array-like Objects can't access common Array prototype methods.
The use case is related to the state of the original array object. So if the parent array container is in one state, the child objects located in each index would each have the same keys but each key may be set at different property values than if the parent array container was found to be in a different state. In addition, retaining the length of the original array is important - just worried about "behavior" in each slot based on the different states of the original array.
Thank you in advance for your insight and guidance.