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 (
You can add whatever methods you like to an Array, by adding them to Array.prototype. Here's an example that adds a getter and setter
Array
Array.prototype
Array.prototype.get = function(index) { return this[index]; } Array.prototype.set = function(index, value) { this[index] = value; }