1

How can I automatically format JavaScript properly?

As an example, this:

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

Should become:

(function(){
    (function(){
        alert('whatever')
    })()
})()
Deduplicator
  • 43,322
  • 6
  • 62
  • 109
Tanner Ottinger
  • 2,860
  • 4
  • 21
  • 27

2 Answers2

2

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

Femaref
  • 59,667
  • 7
  • 131
  • 173
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
  • 325,660
  • 70
  • 395
  • 481