Verstehen der schnellen Alternative apply () in lodash

Ich lese den Quellcode von lo-dash, und finde da schnell alternativ die Funktionapply() Hie.

  function apply(func, thisArg, args) {
    switch (args.length) {
      case 0: return func.call(thisArg);
      case 1: return func.call(thisArg, args[0]);
      case 2: return func.call(thisArg, args[0], args[1]);
      case 3: return func.call(thisArg, args[0], args[1], args[2]);
    }
    return func.apply(thisArg, args);
  }

ch möchte wissen, ob dies eine wirklich effiziente Möglichkeit ist, die schnelle alternative Funktion zu implementiereapply()? Warum gibt es hier nicht mehr als 3 Argumente zu zerlegen?

Antworten auf die Frage(4)

Ihre Antwort auf die Frage