javascript's substr strange behaviour?
<p>I need to extract the date from json : </p>

<pre><code>/Date(1224043200000)/ 
</code></pre>

<p>I <a href="http://stackoverflow.com/questions/206384/how-to-format-a-json-date">saw</a> That I can do it by : </p>

<pre><code>var date = new Date(parseInt('/Date(1224043200000)/'.substr(6))); 
                                    ^
                                    |
------------------------------0123456
</code></pre>

<p>But how does <code>substr</code> knows to ignore the last chars ?
[)/]</p>

<p>I've searched at <a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/substr" rel="nofollow">mdn</a> , but couldn't find the documented behaviour.</p>
