vespercore02 Posted December 6, 2014 Share Posted December 6, 2014 Hi Sirs and Madams, is their/there difference between this two type? of coding? this one function preload(){}function create(){}function update(){} and this one preload: function(){}create: function() {}update: function(){} sorry i'm totally newbie on all js coding or framework Link to comment Share on other sites More sharing options...
Elindur Posted December 11, 2014 Share Posted December 11, 2014 Hi !I guess you're talking about creating a named function :function myLittleFunction() { ... }VERSUS creating an anonymous function and assigning it to a variable/property :var myLittleFunction = function() { ... }There are several differences ; the most "visible" is that you can use a named function before its declaration, but you can't with an anonymous function.You can find more information and pointers here :http://stackoverflow.com/questions/336859/var-functionname-function-vs-function-functionname clark 1 Link to comment Share on other sites More sharing options...
hex13 Posted December 12, 2014 Share Posted December 12, 2014 you can also make function expression with name:var myLittleFunction = function myLittleFunction() { ... }it helps when debugging and makes that function is visible from itself and you can write something likevar someFunction = function myLittleFunction() { requestAnimFrame(myLittleFunction)}; Link to comment Share on other sites More sharing options...
Recommended Posts