Can't push items into array from anonymous callback function in Javascript
<p>I'm having a javascript issue that's driving me completely insane.  I have a collection of data that I'm iterating over using the jQuery .each() method.  Inside the .each() callback function, I'm pushing data on the an array.  Here's the code.</p>

<pre><code>var p = procedure_tool.all();
previousValue = -1;
var proceduresArray = [];
p.each(function(d, proceduresArray) {
proceduresArray.push(d.procedureID);
});
</code></pre>

<p>I've also tried making the proceduresArray global (no var in front), and then trying not to pass it through the anonymous function.  </p>

<pre><code>var p = procedure_tool.all();
previousValue = -1;
proceduresArray = [];
p.each(function(d) {
proceduresArray.push(d.procedureID);
})
</code></pre>

<p>The data does exist (alerts inside the callback display it fine).  Any ideas?  I feel like it's a scope issue, but I figure that globalizing the array would have fixed it.</p>

<p>Thanks</p>
