Proper JavaScript formatting in JavaScript

How can I automatically format JavaScript?

As an example:

(function(){(function(){alert('whatever')})()})()

It should become:

(function(){
    (function(){
        alert('whatever')
    })()
})()
+1
source share
2 answers

There is jsbeautifier , you can find github source code .

+2
source

Try http://jsbeautifier.org/ - it is the same as jsfiddle.net used on the "Tidy Up" button, where you can try.

+2
source

All Articles