Array.prototype.size = function () {return this.length;} Array.prototype.each = function (f) { from_to(0, this.length-1, function (i) {f(this[i]);}); } a = [1,2,3]; print("a.size() is " + a.size()) a.each(print);
Output