Is there a way to get a get/set behaviour on an array? I imagine something like this:
var arr = [\'one\', \'two\', \'three\'];
var _arr = new Array();
for (
It is possible to create setters for each element of an array, but there is one limitation: you would not be able to directly set array elements for indexes that are outside the initialized region (e.g. myArray[2] = ... // wouldn't work if myArray.length < 2) Using the Array.prototype functions will work. (e.g. push, pop, splice, shift, unshift.) I give an example of how to accomplish this here.