1function Arraylike(... args) {
2 this.xarg = args;
3 this.slice = function(num) {
4 return new Arraylike(...this.xarg.slice(num));
5 };
6 this.splice = function(... args) {
7 console.error("Splice is not implemented for now.");
8 };
9 this.toArray = function() {
10 return this.xarg;
11 };
12 this.length = this.xarg.length;
13 for(let i = 0; i < this.xarg.length; i++) {
14 this[i] = this.xarg[i];
15 }
16}
17
18
19
20Array.prototype.toArraylike = function() {
21 return new Arraylike(...this);
22};
23
24
25let yourobject = new Arraylike("whatever", "goes", "here");