Coding anything requires a lot more effort than many believe. The bigger the project, the more difficult to code; you have to take performance, sustainability, updatability, security and so much more into account.
- Avoid placing static variables inside loops. If it doesn’t need to change as a loop runs, it shouldn’t be in the loop. Remember, anything inside a loop will run on each iteration, so try to keep your code trim and tidy.
- According to Ricco Leung from Jask, a Birmingham-based web design firm“Instead of using New Array(), use . You can simply list out items in array like var a = [‘John’,’Smith’]; rather than declaring each item individually.”
- Use a timer function (such as found in Firebug) to run a check on your code, and check for memory leaks and broken code that could potentially be slowing things down.
- Always, always use semi-colons. Whilst modern browsers will probably let you get away without them, they can lead to issues that can cause problems later on. Imagine sifting through hundreds, if not thousands of lines of code fixing issues that arise.
Never jump headfirst into code, especially if what you’re looking to code is going to get complex. The key is in the planning… spend a small amount of time planning at the outset, and you could save much more time in patching problems later on.