Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

ISN'T there any Chrome extension or application to view the clean JAVASCRIPT of any website?

I mean every source code I see, it's all scrambled up and understanding the javascript is almost impossible like that. Is there no extension like JSON viewer or anything like that to help me with that?

3 Answers

Steven Parker
Steven Parker
229,744 Points

What you're seeing is "minified" code.

This is typically done to make the code as compact as possible and reduce loading times. But, it sure makes it hard to read!

And yes, Chrome has a "pretty print" function you can use on minified code. When viewing the source in the dev tools, look for a pair of braces ("{}") on the bottom in the status bar. Clicking on those should reformat the source and make it more readable.

Also, some editors have built-in "beautify" functions, and there are some online resources like Unminify and JS Beautify you can use to make code look better.

That's great, but can you please elaborate on "status bar in dev tools"? couldn't find that.

Steven Parker
Steven Parker
229,744 Points

Sure, here's an example with the braces you click on marked with a blue outline:
dev tools

Oh, I see... Thanks