Result is maintained in javascript array
<p>If I search in an array of objects in javascript, why is the previous result still in memory? I got the following code:</p>

<pre><code>function findTasks( date ) {   
   var result = $.grep( tasks[current].tasks, function( task ) {
      return task.date == date;
   });
   return result; 
}
</code></pre>

<p>When I fire this method and assign it to a variable :</p>

<pre><code>var result = findTasks('24-12-2012'); 
// The hardcoded date is for demonstration (it is dynamic in my application)
console.log( result );
</code></pre>

<p>Then each time I do the <code>findTasks()</code> method, my result of the previous search is being maintained. Even when I do the following:</p>

<pre><code>function findTasks( date ) {   
    var result = null; // Notice this line
    var result = $.grep( tasks[current].tasks, function( task ) {
       return task.date == date;
    });
    return result; 
}
</code></pre>

<p>The results are also maintained.</p>

<p><strong>Edit:</strong>
Each time the findTasks() method fires, the latest results must return. And not the return of the previous method invocations.</p>
