use Array.prototype.slice to process the arguments and avoid loops