How to make your script easy to keep track with?
<p>I know this question is going to be...weird and...odd. I have programmed stuffs for around 4 years until now, since I was 14. I found out that I have changed my ways of writing script quite many times and I don't know which way is better, is there any standard for writing and displaying a script?</p>

<p>Ok, this is how I write when I started [I will make an example with long, deep [whatever] so you can see how I display a script]:</p>

<pre><code>$(document).ready(function()
{
odd=0; even=0;
for(i=0; i&lt;10; i++)
{
for(j=0; j&lt;10; j++)
{
if((i+j)%2==0)
{
even++;
alert(i+j);
}
else
{
odd++;
alert(i+j);
}
}
}
});
</code></pre>

<p>And then, when I started some more complex script, I found out that the way above is completely stupid, so I changed several times the way to write it, and about 2 years ago, I found out a way to write script for myself:</p>

<pre><code>$(document).ready(function()
    {
    odd=0; even=0;
    for(i=0; i&lt;10; i++)
        {
        for(j=0; j&lt;10; j++)
            {
            if((i+j)%2==0)
                {
                even++;
                alert(i+j);
                }
            else
                {
                odd++;
                alert(i+j);
                }
            }
        }
    });
</code></pre>

<p>Well, it looks more clearly right? But recently, I found out that many programmers write script in this way:</p>

<pre><code>$(document).ready(function() {
    odd = 0;
    even = 0;
    for (i = 0; i &lt; 10; i++) {
        for (j = 0; j &lt; 10; j++) {
            if ((i + j) % 2 == 0) {
                even++;
                alert(i + j);
            }
            else {
                odd++;
                alert(i + j);
            }
        }
    }
});
</code></pre>

<p>And I am confused now. I want to have myself a way that will last forever. So I am asking if there is any standard of how to display your script so that it will be easy to keep track of for everyone else?</p>

<p>Thanks for any idea. :P
[x]</p>
