Are you writing a lot of JavaScript code and finding that it's growing into an unmanageable mess? In this concise and focused jump start guide you'll learn how to fix common problems such as function spaghetti code and pollution of the global scope, and gain the skills necessary to write clean JavaScript code. By applying patterns, JavaScript code can be made more modular and easier to work with and that's really the overall purpose of this guide. You'll be provided with focused tips and sample code that will help you write maintainable, re-usable and consistent JavaScript.
Key concepts covered in this guide include:
• Function spaghetti code and why it's bad
• The role of closures
• Namespaces and global scope
• Different techniques for defining variables
• Working with JavaScript's prototype property
• The Prototype Pattern
• The Revealing Module Pattern
• The Revealing Prototype Pattern
The sample code shown is also available as a download.