JavaScript Coding Guideline
什么是编码规范
Section titled “什么是编码规范”编码规范就是指导如何编写和组织代码的一系列标准。通过阅读这些编码规范,你可以知道在各个公司里代码是如何编写的。
我们为什么需要编码规范
Section titled “我们为什么需要编码规范”一个主要的原因是:每个人写代码的方式都是不同的。我可能喜欢这么写,而你喜欢用另一种方法写。如果我们只处理自己的代码,这样并没有什么问题。但如果有成千上万的程序员同时在一个代码库上面工作呢?如果没有规范,事情很快会变得一团糟。代码规范可以让新人迅速的熟悉相关的代码,并且也能写出让其他程序员简单易懂的代码。
5种JavaScript编码规范
Section titled “5种JavaScript编码规范”- Airbnb JavaScript Style Guide https://github.com/airbnb/javascript
- Google JavaScript Style Guide https://google.github.io/styleguide/jsguide.html
- JavaScript Standard Style Guide https://github.com/standard/standard
- jQuery JavaScript Style Guide https://contribute.jquery.org/style-guide/js/
- Idiomatic JavaScript Style Guide https://github.com/rwaldron/idiomatic.js