In jQuery, there are mainly two
jQuery.fn namespace ( $.fn namespace ) and
jQuery namespace ($ namespace )
$ sign is an alias of jQuery (also
known as Hungarian notation). This $ can be returned to its original
i.e. jQuery using jQuery.noConflict(). This is used when $ variable/ sign is
being used by some other library. Also sometime, it is used to handle different
versions of jQuery on the same page.
Each namespace has its own context.
$ Namespace is mainly focused on
utilities functions and its methods are known as core methods. These core
methods do not work with selections.
Ex. $.proxy(), $.each(), $.extend(),
$.trim(' c-sharpcorner.com ');
$.fn namespace (also knowns as jQuery
prototype) focus on methods that works on jQuery objects and these methods are
referred as jQuery object methods. All methods used on this fashion or jQuery
Object Methods - $(expressionForSelection).allMethods()
So, $.each is a jQuery's core method
where $.fn.each is a jQuery Object Method. Later is works on selection (of DOM
works directly or we can say globally with jQuery without any selector.
Another thing is that jQuery object
method returns jQuery object while core methods not(also its return type is
differ on case to case).