Javascript Object inexplicably bound to Window and Object
<p>I've javascript object</p>

<pre><code>var Bucket = function(id) {
     this.id = id
     this.items = []
}
Bucket.prototype.add_item = function(item) {
     //some uniquness checking code here
     this.items.push(item);
}
</code></pre>

<p>For some reason, when I instantiate the object and try to add an item, I get an error</p>

<pre><code>var bct = new Bucket
bct.add_item(some_item)
</code></pre>

<p><code>'undefined' is not an object (evaluating 'this.items.push')</code></p>

<p>This error occurs even though the item is getting added to the array of the bucket</p>

<pre><code>console.log(bct.items)
&gt;&gt; [some_item]
</code></pre>

<p>I used <code>console.log(this)</code> inside the add_items method and I see two entries being logged from the same line</p>

<pre><code>&gt;Object myjavascript.js:28
&gt;DOMWindow myjavascript.js:28
</code></pre>

<p>There are some other libraries included on the page</p>

<ol>
<li>Google Analytics</li>
<li>jQuery</li>
<li>Colorbox plugin for jQuery</li>
<li>jQuery Easing</li>
</ol>

<p>Any ideas what is binding this object to Window?</p>

<hr>

<h1>FOUND IT (Edit)</h1>

<p>somewhere else on the page, I was using a jquery ajax call in combination with my object... and it was binding it... sorry for not posting all of the relevant code...</p>
