This is a great tool that properly formats JavaScript code, making it easy to read and work with. With it you can clean up your own code, or take code from existing functions (like Dreamweaver behaviours) and decrypt them; inserting line breaks and tabs where it makes sense. Best of all, the tool is free!
This tool is similar to the 'apply source formatting' for HTML in Dreamweaver. It has several options:
Here's the example code cleanup from the author's website:
<script language="JavaScript">var i=0,s="",k=0;function foo()
{for(j=0;j<10;j++){for(i=0;i<10;i++){s="string1";
k=Math.floor(Math.random()*10);
for(i=20;i>9;i–){s="string2";k=i;}}}</script>
This gets run through the 'JavaScript Code Improver', and becomes:
<script language="JavaScript">
var i = 0, s = "", k = 0;
function foo()
{
for(j = 0; j < 10; j++)
{
for(i = 0; i < 10; i++)
{
s = "string1";
k = Math.floor( Math.random()*10 );
}
for(i = 20; i > 9; i–)
{
s = "string2";
k = i;
}
}
}
</script>
Much easier to read and work with! You can download the tool for free here. Note: while this tool does clean up and format obfuscated code, it may still be difficult to understand!
Sign up for our daily email newsletter:
You must log in to post a comment.