当前位置

网站首页> 程序设计 > 开源项目 > 程序开发 > 浏览文章

Javascript Style Guide

作者:小梦 来源: 网络 时间: 2024-06-16 阅读:

原文: https://github.com/airbnb/javascript

JavaScript规范

内容列表

  1. 类型

  2. 对象

  3. 数组

  4. 字符串

  5. 函数

  6. 属性

  7. 变量

  8. 条件表达式和等号

  9. 注释

  10. 空白

  11. 逗号

  12. 分号

  13. 类型转换

  14. 命名约定

  15. 存取器

  16. 构造器

  17. 事件

  18. 模块

  19. jQuery

  20. ES5 兼容性

  21. 性能

  22. 资源

  23. 哪些人在使用

  24. 翻译

  25. JavaScript风格指南

  26. 贡献者

  27. 许可

类型

对象

数组

// badsomeStack[someStack.length] = 'abracadabra';// goodsomeStack.push('abracadabra');```

字符串

// goodvar errorMessage = 'This is a super long error that ' +  'was thrown because of Batman.' +  'When you stop to think about ' +  'how Batman had anything to do ' +  'with this, you would get nowhere ' +  'fast.';```

函数

属性

变量

条件表达式和等号

注释

空白

逗号

分号

类型转换

命名约定

存取器

构造器

事件

[?]

模块

jQuery

许可

(The MIT License)

Copyright (c) 2012 Airbnb

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

[?]

};

热点阅读

网友最爱