Google JavaScript Style Guide

A JavaScript style guide to go along with Google’s HTML & CSS style guide

JavaScript is the main client-side scripting language used by many of Google’s open-source projects. This style guide is a list of dos and don’ts for JavaScript programs.


Here are some really good one’s

  • Always use semicolons
  • Declarations with var: Always
  • Use a variable initialized with a Function Expression to define a function within a block
  • Associative Arrays are not allowed
  • Because of implicit semicolon insertion, always start your curly braces on the same line as whatever they’re opening.
  • For consistency single-quotes (‘) are preferred to double-quotes (“)
pep.jquery.js

Pep was built out of a need for kinetic drag support for both mobile and desktop devices (click and drag). It uses jQuery and CSS3 animations to bring full-blown ‘kinetic drag’ to HTML5-ready environments.

pep.jquery.js

Pep was built out of a need for kinetic drag support for both mobile and desktop devices (click and drag). It uses jQuery and CSS3 animations to bring full-blown ‘kinetic drag’ to HTML5-ready environments.

A Tron Game in 219 Bytes of JavaScript - Explained

Alok Menghrajani and some coworkers set out to do some JavaScript ‘golfing’ and came up with a 219 byte ‘tron’ style game. The techniques used are interesting and they’re all explained here.

Newer Older

Page 2 of 16