Probably you've become confused by the arguments
variable and call()
function.
Try to debug and all becomes more clearer:
function list() {
console.log('Function hidden args: ', arguments)// Output: Function hidden args: [1, 2,
//3, callee: ƒ, Symbol(Symbol.iterator): ƒ]
return Array.prototype.slice.call(arguments, 0);
}
var list1 = list(1, 2, 3); // [1, 2, 3]
So this return Array.prototype.slice.call(arguments, 0);
can be converted to
[/*array items here*/].slice(0)
0
means here a starting point from existing array where new array will be created.
For example:
console.log([1,2,3,4,5].slice(1)); // [2, 3, 4, 5]
console.log([1,2,3,4,5].slice(2)); // [3, 4, 5]
console.log([1,2,3,4,5].slice(3)); // [4, 5]