Jump to content

Phaser coding question


Recommended Posts

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 :

Link to comment
Share on other sites

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 like

var someFunction = function myLittleFunction() {  requestAnimFrame(myLittleFunction)};
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...