Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
216,000 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
216,000 Points

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

Oh, I see... Thanks