Understanding function parameters
<p>This probably has been asked before but all I can find are questions regarding C and Bash etc.</p>

<p>Basically I'm having a really hard time getting my head around function parameters and what they reference.</p>

<p>I know that you usually set paramters when you call the function e.g. <code>doSomething(3,'Hello')</code> etc, but when I read code from tutorials like so;</p>

<pre><code>window.onload = initAll;

function initAll() {
    if (document.getElementById) {
        for (var i=0; i&lt;24; i++) {
            setSquare(i);
        }
    }
    else {
        alert("Sorry, your browser doesn't support this script");
    }
}

function setSquare(thisSquare) {
    var currSquare = "square" + thisSquare;
    var colPlace = new Array(0,0,0,0,0,1,1,1,1,1,2,2,2,2,3,3,3,3,3,4,4,4,4,4);
    var colBasis = colPlace[thisSquare] * 15;
    var newNum = colBasis + getNewNum() + 1;

    document.getElementById(currSquare).innerHTML = newNum;
}

function getNewNum() {
    return Math.floor(Math.random() * 15);
}
</code></pre>

<p>Where is <code>setSquare()</code> getting the parameter of <code>thisSquare</code> from?</p>
