Retrieve year out of text best solution?
<p>I want to retrieve de year out of this date (european format date) i know this as a solution but is there a better way to write this code(less code,less declarations etc..)?</p>

<p>You don't need to use those variables. Only variable needed is date = "22/3/2011"</p>

<p>Code in javascript:</p>

<pre><code>var myDate = "22/3/2011",
    pos = myDate.lastIndexOf("/"),
    myYear="1970";

myYear = myDate.substr(pos+1);
</code></pre>

<p>I used jsperf to see which solution was the fastest
<a href="http://jsperf.com/retrivetextoutofdate/2" rel="nofollow">http://jsperf.com/retrivetextoutofdate/2</a></p>
