Skip to content

JavaScript Style Guide

Anthony Nandaa edited this page Sep 10, 2015 · 9 revisions

It's important to write JavaScript (and code in any language) in a way that conforms with the way the rest of the world does it, and especially in a way that the rest of your team does it. For example, I should be able to predict that a phone number variable in your codebase is called phoneNumber and not phonenumber or phone_number. If I'm a programmer on your project and each variable name or function name is potentially a special case and I have to look it up individually, that's probably going to annoy me and slow me down. Predictable coding conventions help pave the way for smooth productivity.

Code that's consistently formatted is also simply nicer to look at and more enjoyable to work with. It's like living in a clean house.

Here is a number of good JavaScript style guides for reference: