global variable in javascript
<p>Good day!</p>

<p>I am writing a script as follows:</p>

<pre><code>var prev = 0;

$(document).ready(function(){
    dynamicListOne(length, prev);
});

function dynamicListOne(length, prev){
   length++;
   prev = length;
}
</code></pre>

<p>But prev is always 0.
How can i assign prev=length?</p>

<p>Thank you in advance</p>
