Skip to content

Instantly share code, notes, and snippets.

@hotoo
Created August 17, 2013 07:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hotoo/6255799 to your computer and use it in GitHub Desktop.
Save hotoo/6255799 to your computer and use it in GitHub Desktop.
支付宝 JavaScript 编码风格指南『草案』
// 变量
var $ = require("$");
var userName = "用户名";
var password = "密码";
// 允许连续声明多个变量。
var name, age, type;
// 靠近变量使用的地方进行变量声明。
// 并且有连续声明多个变量。
// 另外这也是推荐的多行注释风格。
for(var i=0,l=list.length; i<l; i++){
}
// 常量
var PI = 3.14;
var THIS_IS_CONSTANT_STRING = "常量";
// 类定义
function ClassA(key){
this._key = key;
}
var DEFAULT_TYPE = "default type";
var ClassB = function(type){
this.type = type || DEFAULT_TYPE;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment