How do I increase the scope of a variable in JavaScript?
<p>I've got the following code:</p>

<pre><code>$('.task-list').each(function(list, response) {
    response = $('#' + this.id).sortable('toArray');
});
console.log(response);
</code></pre>

<p>The error I'm getting is response is undefined. I tried adjusting line 2 to be <code>var response</code> but got the same error.</p>

<p>I'm trying to build an array of data by looping over the items on the page and then submitting a single ajax response to the server to update it.</p>
