In so many JavaScript libraries, I see global, factory as parameters of functions.
Eg:
jQuery:
( function( global, factory ) {
"use strict";
if ( typeof module === "object" && typeof module.exports === "object" ) {
//...
Vue.js:
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.Vue = factory());
}(this, function () { 'use strict';
/* */
// ...
There probably are much more examples...
My question is: Why is the global and factory used as parameters so often and what are they?