On various sites, jQuery’s $ variable is referred to as an alias, and on others, it is referred to as a factory. I took a look at the source code, and I think the former is correct. As far as I can see, the dollar symbol is being defined here:
// Expose jQuery to the global object
return (window.jQuery = window.$ = jQuery);
This is setting both $ and jQuery to the SAME alias; there is no ‘factory’ for jQuery objects. Are the sites referring to $ as a ‘factory’ simply wrong?
I think either is an okay term. The dollar sign is certainly an alias for the
jQueryfunction, specifically to be used as a shorthand. If someone refers to the function as a factory, I don’t think that’s specific to the$alias, but just describing what thejQueryfunction does in general, which is create objects from various different types of input.