Appendix A. JavaScript coding standard

This appendix covers:
  • Exploring why a coding standard is important
  • Laying out and documenting code consistently
  • Naming variables consistently
  • Isolating code using namespaces
  • Organizing files and ensuring consistent syntax
  • Validating code using JSLint
  • Using of a template that embodies the standard

Coding standards are contentious. Almost everyone agrees you should have one, but few seem to agree on what the standard should be. Let’s consider why a coding standard is especially important for JavaScript.

A.1. Why we need a coding standard

Having a well-defined standard for a loosely typed, dynamic language like JavaScript is almost certainly more important than with stricter languages. ...

Get Single Page Web Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.