what's the difference between jQuery function
$.FunctionName = function(){ alert('Hello!') }
and normal javascript function?
function FunctionName(){ alert('Hello!') }
The first becomes a static method of the jQuery object. The latter becomes just a regular function.
The only difference is really the owner of the function. The jQuery object / constructor owns the first method, and the object windowbelongs to the second method, assuming that it is not defined in another scope of the function.
window
, , , jQuery. , .
. .
, - ( not $), my_lib={}, ,
my_lib={}
my_lib.FunctionName = function(){ alert('Hello!'); }
my_lib={ FunctionName: function(){ alert('Hello!'); } }
Source: https://habr.com/ru/post/1772955/More articles:Why does setting a default make this function private? - closureshttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1772951/alternatives-to-jpegreadheader-libjpeg&usg=ALkJrhhtyQ_jq3tJfQZFrba7VtHULYXFOQC ++ private constructors - c ++Usefulness of loading instances in OO PHP? - objectBest practice for uploading .Net project to web server - version-controlWhen I click, I want to add the value of the a-tag to the input field - javascriptsingle quote in file name - javascript, php - javascriptfind all rows in a list containing x or y? - listSet thread volume ALSA - linuxWhat is a syntax shortcut? - jqueryAll Articles