1

How can I automatically format JavaScript properly?

As an example, this:

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

Should become:

(function(){
    (function(){
        alert('whatever')
    })()
})()
Deduplicator
  • 44,692
  • 7
  • 66
  • 118
Tanner Ottinger
  • 2,970
  • 4
  • 22
  • 28

2 Answers2

2

There is the jsbeautifier, you can find the source code at github.

Femaref
  • 60,705
  • 7
  • 138
  • 176
2

Try http://jsbeautifier.org/ - it's the same one used by jsfiddle.net on their "Tidy Up" button where you can try it out.

Alnitak
  • 334,560
  • 70
  • 407
  • 495