Format JavaScript code

Source: Internet
Author: User

JavaScript code formatting Tool

JS downloaded onlineCodeCode is often compressed (comments, line breaks, indentation, spaces, tabs, and so on are all deleted). If you are studying and studying the code, you will be dizzy. Some editor's "lattice code" function can solve this problem. I searched the internet and found some such tools. Among them, sourceformatx is good and supports many languages, however, fees apply. Unregistered codes larger than 8 K cannot be formatted. The registration fee is 188 yuan, which is too expensive. Although textrush is free of charge, it seems that it has not been released at all; polystyle seems to be good; vs.net plug-in resharper also has this function, such tools seem to have: trita, Eclipse, etc., but finally found the JavaScript code improver, a free tool. He is very simple. Only this function is used to format Js. It can also be used to format and mix HTML code.
Effect:

<Script language = "JavaScript"> var I = 0, S = "", K = 0; function Foo () {for (j = 0; j <10; j ++) {for (I = 0; I <10; I ++) {S = "string1"; k = math. floor (math. random () * 10) ;}for (I = 20; I> 9; I --) {S = "string2"; k = I ;}}</SCRIPT>

After formatting:

In addition, if you want to compress JavaScript code, you can use this: http://www.brainjar.com/js/crunch/demo.html

To use this tool, make sure that each statement is followed by a semicolon (';'Otherwise, an error similar to "Expected ';'" or "missing; before statement" will be reported. For example
X = 3.141592
Y = 2.718281

Will becomeX = 3.141592 y = 2.718281Is an incorrect statement. But there is also a benefit, you can check which places you have missed a semicolon. It is easier to skip the semicolon:P. onreadystatechange = function (){....};AndRssinfos [I] = {ID: idstr, URL: urlstr };These two types.

 

From: http://blog.donews.com/bigcarp/archive/2006/01/12/691890.aspx

 

Supplement:

JavaScript code Improver

JavaScript code improver is an easy-to-use utility that makes the JavaScript code in your web pages well-structured ured and easily comprehensible thus saving the time you spend on editing, debugging and modifying it. the program features the multilingual interface and support for drag-n-drop operations, and can handle into cripts embedded in the web pages as well as stored in standalone. JS files.

Web site: http://jcay.com/id-190119110113039.html download:Http://jcay.com/jscisetup.exe

 

1. Javascript formatting and compression tools can format JavaScript code that is compressed or not formatted

JavaScript code can be compressed

Web: http://www.div-css.com/f/tool/js-format-compress.html

 

 

 

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.