Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,36 @@
// A prototype declaration for a function that does not require arguments
function List() {}
List.prototype.push = function() {
return [].push.apply(this, arguments);
};
List.prototype.pop = function() {
return [].pop.call(this);
};
var l = new List();
l.push(5);
l.length; // 1
l[0]; 5
l.pop(); // 5
l.length; // 0
// A prototype declaration for a function that utilizes varargs
function List() {
this.push.apply(this, arguments);
}
List.prototype.push = function() {
return [].push.apply(this, arguments);
};
List.prototype.pop = function() {
return [].pop.call(this);
};
var l = new List(5, 10, 15);
l.length; // 3
l[0]; 5
l.pop(); // 15
l.length; // 2

View file

@ -0,0 +1,37 @@
// A prototype declaration for a function that does not require arguments
class List {
push() {
return [].push.apply(this, arguments);
}
pop() {
return [].pop.call(this);
}
}
var l = new List();
l.push(5);
l.length; // 1
l[0]; 5
l.pop(); // 5
l.length; // 0
// A prototype declaration for a function that utilizes varargs
class List {
constructor(...args) {
this.push(...args);
}
push() {
return [].push.apply(this, arguments);
}
pop() {
return [].pop.call(this);
}
}
var l = new List(5, 10, 15);
l.length; // 3
l[0]; 5
l.pop(); // 15
l.length; // 2