var complexFunction = function(arg1, arg2) {}; var cachedFunction = cache(complexFunction); function cache(func) { return function(){ func.apply(this, arguments); for (var i = 0; i < arguments.length; i++){ console.log(arguments[i]); } };} cachedFunction('foo', 'bar'); 
  • the problem is that, along with the parameters, functions that are not declared are transferred, I do not understand what these functions are and how to remove them. - lesha310392
  • What are you talking about? - user220409
  • arguments = ["foo", "bar", callee: function, Symbol (Symbol.iterator): function] the result is how to get only foo and bar - lesha310392
  • arguments is a pseudo-array, so you get arguments.calee , use slice to convert this pseudo- var args = Array.prototype.slice.call(arguments); - Umer

0