jeudi 10 novembre 2016

why makes anonymous function have more arguments in its statement then in the invocation

(function(i, s, o, g, r, a, m) {
      i['GoogleAnalyticsObject'] = r;
      i[r] = i[r] || function() {
          (i[r].q = i[r].q || []).push(arguments)
      }, i[r].l = 1 * new Date();
      a = s.createElement(o),
          m = s.getElementsByTagName(o)[0];
      a.async = 1;
      a.src = g;
      m.parentNode.insertBefore(a, m)
  })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');

  ga('create', 'UA-28239486-5', 'auto');
  ga('send', 'pageview');

This is the Google Analytics script. In the anonymous function, there are 7 arguments, but when being invoked, there are only 5. Why then the code would make a and m as arguments? I see no difference in doing var a and var m in the function body.

Aucun commentaire:

Enregistrer un commentaire