Javascript Best Practices Take 1

I like Javascript; I use it everyday in my work and read article after article on new and old ways to use it.

  • Load Javascript in the Footer

    First off is load times are affected; you can find out more about this by checking out Steve Souders site and more specifically Rule 6 of his book High Performance Web Sites.

  • JSLint

    As a PHP programmer I make use of the php syntax checker via the command line “php -l %filename” (at least on windows). JSLint does syntax checking and more so it is definitely something that should be used. I’d love to use a command line version like in PHP though I haven’t found it yet but then again maybe I’m just not observant enough.

  • Using a CDN

    This is especially true if your running multiple sites. Rather than having each site host it’s own JS use a CDN; I generally use Google AJAX libraries for jQuery but lately have been looking at Yahoo for their YUI. If you’re loading your JavaScript in the footer this works great since ,at least with Google, you call your “google.load()” function and then work from there with the Callback function.

  • Javascript should not be a replacement for CSS

    Use JavaScript appropriately; It’s amazing what can be done with just CSS. Find whatever resources you can, I recommend CSS-Tricks and Smashing Magazine as two of the best places to start.

Hopefully this is helpful to someone as short as it is.

You can leave a response, or trackback from your own site.

Leave a Reply

Free Sprint phones for sale | Thanks to CD Rates, Reverse Phone and Registry Software