You are reading a single comment by @Stev and its replies. Click here to read the full conversation.
  • Funny. As I usually use the functional notation. Only since working with the touchscreen code I used the direct function declaration because the touchscreen examples were written that way :)

    Notation-wise it might make sense to differentiate them (named function vs function var with anonymous function), but I don't know what JSs spec actually says.

    I just remember that in a coding context/script, direct function declarations are parsed befor the actual script execution while the var = function(){} notation is a executed as part of the normal execution sequence (making the former being present/declared for code positioned before the function declaration, while the latter wouldn't).

    Also, in espruino, when I do a

    touch
    

    i'll get

    =function (x,y) { ... }
    

    in both cases. And both objects can be combined with additional methods.

    Just was that thing that left me confuse about the copying vs. referencing idea for function(object)s and wanting to be able to delete that callback . Because once you screwed it...

About

Avatar for Stev @Stev started