Advertise here

Google JavaScript Style Guide

March 30, 2018     439    
Google JavaScript Style Guide

A tutorialabout Google’s coding standards for source code in the JavaScript programming language. The best stylistic practices for writing clean, understandable code.

Table of Contents

1 Introduction
1.1 Terminology notes
1.2 Guide notes
2 Source file basics
2.1 File name
2.2 File encoding: UTF-8
2.3 Special characters
3 Source file structure
3.1 License or copyright information, if present
3.2 @fileoverview JSDoc, if present
3.3 goog.module statement
3.4 goog.require statements
3.5 The file’s implementation
4 Formatting
4.1 Braces
4.2 Block indentation: +2 spaces
4.3 Statements
4.4 Column limit: 80
4.5 Line-wrapping
4.6 Whitespace
4.7 Grouping parentheses: recommended
4.8 Comments
5 Language features
5.1 Local variable declarations
5.2 Array literals
5.3 Object literals
5.4 Classes
5.5 Functions
5.6 String literals
5.7 Number literals
5.8 Control structures
5.9 this
5.10 Disallowed features
6 Naming
6.1 Rules common to all identifiers
6.2 Rules by identifier type
6.3 Camel case: defined
7 JSDoc
7.1 General form
7.2 Markdown
7.3 JSDoc tags
7.4 Line wrapping
7.5 Top/file-level comments
7.6 Class comments
7.7 Enum and typedef comments
7.8 Method and function comments
7.9 Property comments
7.10 Type annotations
7.11 Visibility annotations
8 Policies
8.1 Issues unspecified by Google Style: Be Consistent!
8.2 Compiler warnings
8.3 Deprecation
8.4 Code not in Google Style
8.5 Local style rules
8.6 Generated code: mostly exempt
9 Appendices
9.1 JSDoc tag reference
9.2 Commonly misunderstood style rules
9.3 Style-related tools
9.4 Exceptions for legacy platforms

Related Plugins

Latest Plugins


Subscribe to Newsletter

Subscribe to email newsletter for latest jQuery plugins & tutorials.



AdvertisementAdvertise with us!