something very strange happening in javascript object construction
<p>This is really bizarre. I've created an image handling object that stores an array of images and displays them on a page, among other methods. However, for some reason it's behaving really strangely. Here's a console log from chrome:</p>

<pre><code>default constructor imgHandler.js:16
[null] imgHandler.js:17
GET http://localhost:8080/cglst/images/null 404 (Not Found) jquery-1.7.2.min.js:4
    f.fn.extend.html jquery-1.7.2.min.js:4
    e.extend.access jquery-1.7.2.min.js:2
    f.fn.extend.html jquery-1.7.2.min.js:4
    update imgHandler.js:65
    $.ajax.success addform.php:239
    f.Callbacks.o jquery-1.7.2.min.js:2
    f.Callbacks.p.fireWith jquery-1.7.2.min.js:2
    w jquery-1.7.2.min.js:4
    f.support.ajax.f.ajaxTransport.send.d jquery-1.7.2.min.js:4
</code></pre>

<p>and so here's the constructor in imgHandler.js:</p>

<pre><code>function imgHandler(imgString) {
    if (imgString != null &amp;&amp; imgString != "null") {
        this.img = imgString.split(",");
        this.size = this.img.length;
        console.log("parametrized constructor")
        console.log(this.img);
    } else {
        this.img = Array("defaultimage.png");
        this.size = 0;
        console.log("default constructor")
        console.log(this.img);
    }
</code></pre>

<p>And here are lines 238-240 of addform.php:</p>

<pre><code>                    imgHandle = new imgHandler(data.results[0].photos);
                    imgHandle.update();
                    updatePreview();
</code></pre>

<p>I have no idea how this is possible, since I set <code>this.img</code> to an array of one image filename literally two lines before <code>console.log("default constructor")</code>...</p>
