Why does the browser get stuck in this javascript loop?
<p>I can't spot why the browser hangs and gets caught in the first for loop in this function, arguments.length doesn't print a console.log either.</p>

<p>Here is the click function passing the colorpicker's own id then the variable other properties to be changed:</p>

<pre><code>$('#colorSelector3').click(function(){
colorPickDynamic('#colorSelector3','h1','color');
});
</code></pre>

<p>Here is the function where the browser hangs in the first for loop:</p>

<pre><code>function colorPickDynamic(cp){
    var i,
        j,
        x,
        tag = [],
        colorProperty = [];

    for (x=0, i = 1, j = 2; x &lt;= arguments.length; i+=2, j+=2, x++) {

        tag[x]=arguments[i];
        colorProperty[x]=arguments[j];

        console.log(arguments.length);
        console.log(colorProperty[x]);
    }

    $(cp).ColorPicker({
        color: '#0000ff',
        onShow: function (colpkr) {
            $(colpkr).fadeIn(500);
            return false;
        },
        onHide: function (colpkr) {
            $(colpkr).fadeOut(500);
            return false;
        },
        onChange: function (hsb, hex, rgb) {
            for (j = 2; j &lt; arguments.length; j+=1) {
                $(tag[0]).css(colorProperty[0], '#' + hex);
            }
            $(cp + ' div').css('backgroundColor', '#' + hex);
        }
    });
}
</code></pre>

<p>any help would be amazing! Thanks</p>
