javascript test method not working as expected
<p>I have a conditional logic based on the <code>OS</code> version no. in the browser <code>useragent</code> string.</p>

<p>Here is the code i tried.</p>

<pre><code>var useragent = "Linux; U; Android 2.2.1; en-gb; HTC_DesireZ_A7272 Build/FRG83D";

if((/2.3/).test(useragent)){
   alert("2");
}
else if((/3./).test(useragent)){
   alert("3");
}
else if((/4./).test(useragent)){
   alert("4");
}
else {
   alert("5");
}
</code></pre>

<p>I always get an alert with <code>3</code>.</p>

<p>I tried replacing <code>test</code> method with <code>indexOf</code> and i get an alert with <code>5</code>.</p>

<p>Can somebody explain why <code>(/3./).test(useragent)</code> returns true?</p>
