Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Standard is used to manage how to write JavaScript code

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

In this issue, the editor will bring you about how Standard is used to manage JavaScript code. The article is rich in content and analyzed and described from a professional point of view. I hope you can get something after reading this article.

How can we make the JavaScript code written by the front-end team have a uniform style and conform to the specification? To solve this problem, my answer is that you don't have to do anything, someone has done all the above four steps for you!

About what standard is.

What is standard? An open source JS code specification library that does the following

Formulated the so-called standard (standard) JS code specification

With the editor plug-in, you can check code specifications and syntax errors in real time.

Check for code specifications and syntax errors by executing commands

Automatically fix non-compliant code (which can be repaired directly) to make it conform to the specification

About the Code Specification in standard

It can be said that one of the charms of JS is its free and open way of writing. Compared with python, Go and other languages, JS is much more free to write. But this freedom itself brings a lot of inconvenience in teamwork projects, so we need to specify code specifications, but what standards should be used to develop specifications? Is the indentation 4 or 2, and do you want to end with semicolons, curly braces and if statements on the same line or on another line? There is no standard answer to questions like this in terms of function and logic, because no matter how you choose, the code can run and the function can be implemented. So in the world of JS programmers, there are often arguments about indentation, semicolons, line breaks, and so on, and the standard library concludes that this debate doesn't make sense for gettingstuffdone, and we need to stop it and focus on solving the problem.

The official statement given by standard is as follows:

Therearelotsofdebatesonlineabouttabsvs.spaces,etc.thatwillneverberesolved.Thesedebatesjustdistractfromgettingstuffdone.Attheendofthedayyouhaveto'justpicksomething',andthat'sthewholephilosophyofstandard--itsabunchofsensible'justpicksomething'opinions.Hopefully,usersseethevalueinthatoverdefendingtheirownopinions.

The above is the Standard shared by the editor to manage how the JavaScript code is written. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report