Home  >  Article  >  Web Front-end  >  Detailed introduction to several JavaScript coding specifications (detailed tutorial)

Detailed introduction to several JavaScript coding specifications (detailed tutorial)

亚连
亚连Original
2018-06-08 18:11:571470browse

Coding specifications are a series of standards that guide how to write and organize code. The following article brings you 5 types of JavaScript coding specifications. Friends in need can refer to it

What is Coding specifications

Coding specifications are a series of standards that guide how to write and organize code. By reading these coding standards, you can get an idea of ​​how code is written in various companies.

Why we need coding standards

One main reason is: everyone writes code differently. I might like to write it one way and you like to write it another way. This is fine if we only deal with our own code. But what if there are thousands of programmers working on a code base at the same time? Without discipline, things can get messy quickly. Code specifications allow newcomers to quickly become familiar with the relevant code, and they can also write code that is easy for other programmers to understand.

Airbnb JavaScript Style Guide

claims to be "the most reasonable way to write JavaScript code."

Airbnb’s code specification may be the most popular JavaScript code specification on the Internet. It has 60,000 stars on Github and covers almost every feature of JavaScript.

Address: https://github.com/airbnb/javascript

Google JavaScript Style Guide

Only follow The rule here is that a JavaScript source file can be called "Google Style". It is very domineering and goes its own way, and it is also used by many companies.

Address: https://google.github.io/styleguide/jsguide.html

Idiomatic JavaScript Style Guide

JavaScript code specifications that conform to language habits.

No matter how many people are involved, or whether they are in the same code base, all JavaScript code must look like it was written by the same person.

Another very powerful and popular JavaScript coding specification. It also has great ambitions. It not only wants to standardize JavaScript, but also wants to regulate other languages.

Does all the code on the planet look like it was written by the same person? Thinking about it makes people shudder...

Address: https://github.com/rwaldron/idiomatic.js

##JavaScript Standard Style Guide

A powerful JavaScript code specification, with built-in linter and automatic code correction, no configuration required, and automatic code formatting. Low-level errors in the code can be discovered early in the coding process. This code specification is adopted by many well-known companies, such as NPM, GitHub, mongoDB, etc.

Address: https://github.com/standard/standard

(This Github address is so domineering.)

jQuery JavaScript Style Guide

jQuery is a good helper for many people to get started with the front-end. Unfortunately, now there are only memories left. Their specification is considered a very early code specification, mainly stipulating their code and early JavaScript versions.

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

How to use Puppeteer image recognition technology to implement Baidu index crawler

Realize magnifying glass through jquery technology

Implement automatic page update in webpack-dev-server

The above is the detailed content of Detailed introduction to several JavaScript coding specifications (detailed tutorial). For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn