JS Quicktip: Reflect.apply() for slicing function arguments

How often have you written this line?

var args = Array.prototype.slice.call(arguments);

Well, with ES2015 Reflect.apply(target, thisArgument, argumentsList) effectively deprecates Function.prototype.apply and Function.prototype.call.

And how do you do that with array like arguments object? That’s how:

const args = Reflect.apply(Array.prototype.slice, arguments, []);