简体   繁体   中英

Reading Java Script / PHP similar files / Lack of line breaks

I'm from a very much C/Java type background. I'm used to text maybe being maybe not more than 150 odd characters across the page before moving on to a new line effectively declaring a statement.

Currently I'm trying to open a Javascript file In particular this time it's from this package here: http://baymard.com/labs/country-selector

When I open the file in pretty much any editor Notepad/Textpad/IntelliJ it has very few line breaks and spreads across the page at up to 500 characters across.

Now I'm aware that I don't really know Javascript but without the line breaks it just seems unreadable to me. Is it really meant to be this way or do I need a special editor?!

I've seen this a few times before and each time circled the issue of actually trying to understand the code within. I've also seen the same when trying to read PHP files. It just opens as one big mass of text which I find I can't begin to comprehend.

I've tried Googling for answers to this problem but very little comes up.

What am I missing?!

You mean the source code found here: https://github.com/JamieAppleseed/selectToAutocomplete ?

Well, in jquery.js and jquery-ui-autocomplete.js the source code is minified, so yeah, that is intented to be so. But almost every IDE should support auto-formatting the source code the way you want, so that it becomes better readable again. But, if you check out the jQuery-Website, there should also be a non-minified version of jQuery available.

Check out the jquery.select-to-autocomplete.js file, it is not minified and contains the source code the author actually wrote (the others are just libraries that he uses, hence they are minfied). You will notice it is much better readable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM