Give help. Get help.

  • # June 12, 2013 at 1:09 pm


    Curious to know if there is a preferred practice for the location of global variables. I like to organize variables at the top of all my functions…just inside the document ready. Is this the best method? Or is it better to place variables right before the associated function?

    Any advice is welcome…thank you

    # June 12, 2013 at 1:16 pm

    I put all global variables at the top of the JS file, before the document ready (unless, of course, they require the document to be ready).

    # June 12, 2013 at 3:44 pm

    As a general rule, I avoid global variables whenever possible, to keep things neatly organized and prevent potential name conflicts.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.