3663 se = (function (t) {
3664 var e, n;
3665 function o() {
3666 return t.apply(this, arguments) || this;3667 }
3668 (n = t),
3669 ((e = o).prototype = Object.create(n.prototype)),
2174 function t(e, n) {
2175 var i = this,
2176 o =
2177 arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};2178 V(this, t),
2179 (this.scheduleUpdate = function () {
2180 return requestAnimationFrame(i.update);
2174 function t(e, n) {
2175 var i = this,
2176 o =
2177 arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};2178 V(this, t),
2179 (this.scheduleUpdate = function () {
2180 return requestAnimationFrame(i.update);
1646 ],
1647 Tt = Et.slice(3);
1648 function Ct(t) {
1649 var e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1],1650 n = Tt.indexOf(t),
1651 i = Tt.slice(n + 1).concat(Tt.slice(0, n));
1652 return e ? i.reverse() : i;
1646 ],
1647 Tt = Et.slice(3);
1648 function Ct(t) {
1649 var e = arguments.length > 1 && void 0 !== arguments[1] && arguments[1],1650 n = Tt.indexOf(t),
1651 i = Tt.slice(n + 1).concat(Tt.slice(0, n));
1652 return e ? i.reverse() : i;
There are rest parameters in ES2015
. We can use that feature for variadic functions instead of the arguments
variable.
arguments
does not have methods of Array.prototype
, so it's a bit of an inconvenience.
function foo() {
console.log(arguments);
}
function foo(action) {
var args = Array.prototype.slice.call(arguments, 1);
action.apply(null, args);
}
function foo(action) {
var args = [].slice.call(arguments, 1);
action.apply(null, args);
}
function foo(...args) {
console.log(args);
}
function foo(action, ...args) {
action.apply(null, args); // or `action(...args)`, related to the `prefer-spread` rule.
}
// Note: the implicit arguments can be overwritten.
function foo(arguments) {
console.log(arguments); // This is the first argument.
}
function foo() {
var arguments = 0;
console.log(arguments); // This is a local variable.
}