- Format scripts neatly. Keep them readable. Use consistent spacing and give variables meaningful names.
- Declare all variables with the var keyword. This will avoid problems with variable scope and thus any confusion.
- Always use the theory of reduction. Divide complexity into smaller tasks as a way of solving larger problems. Divide complex scripts into meaningful functions where each function completes a specific task.
- When writing large scripts write that large script in distinct and separate phases. Test each phase and ensure each functions as required before proceeding to the next phase.