• I'm not sure I can be much help either, except to say that IMO it's a good idea to re-use as much code as possible. If you've got a function you're using in both places, definitely keep that.

    Also, for anything more than a few lines it's worth using a named function rather than just inserting it into a setWatch/setInterval. eg.:

    //Use:
    
    function onSecond() {
    ...};
    setInterval(onSecond, 1000);
    
    //rather than:
    
    setInterval(function() {
    ...}, 1000);
    

    As it allows you toreplace the function in running code if you're developing and want to tweak something.

    But I'm not convinced that really answers your question :)

About

Avatar for Gordon @Gordon started