Created
August 17, 2013 07:54
-
-
Save hotoo/6255799 to your computer and use it in GitHub Desktop.
支付宝 JavaScript 编码风格指南『草案』
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 变量 | |
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