Declare functions in JavaScript -


this question has answer here:

i have code:

function myfunction(){     alert("hello"); } 

and other code:

var myfunction = function(){  } 

what difference?

the first normal way declare function in javascript. call referring name, myfunction().

the second anonymous function stored in variable functions first class citizens in javascript. variable myfunction holds anonymous function.

basically first normal function while second variable holding anonymous function.


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Website Login Issue developed in magento -

Can the constants be defined inside a model file of a framework in PHP? -