strict search of string to validate month in javascript
<p>What I'd like to do is a strict search of the months jan feb mar apr ...etc inputted into a text field formatted as</p>

<p>mmmyyyy (ex:jan1993).</p>

<p>I'd like to validate this so that the user can input either all lowercase or all uppercase (jan/JAN).</p>

<p>what I did doesn't seem to work.</p>

<pre><code>     var firstM =month.charAt(0,2);
     var months = 
         {
           "jan" : "JAN",
           "feb" : "FEB",
           "mar" : "MAR",
           "apr" : "APR",
           "may" : "MAY", 
           "jun" : "JUN",
           "jul" : "JUL",
           "aug" : "AUG",
           "sep" : "SEP",
           "oct" : "OCT",
           "nov" : "NOV",
           "dec" : "DEC"
         };



 else if (firstM !== months[firstM])
        {
          errMessages += "&lt;li class='b1'&gt; Date of Birth must start with 3 letter month&lt;/li&gt;\n";
          errMessages += "&lt;li class='b2'&gt; ex: mmmyyy / JAN1993&lt;/li&gt;\n";
        }
</code></pre>

<p>I'm still getting use to figuring out how to utilize .charAt with the "jan" : "JAN" i figured if i did it like this, the user could input either all lowercase or all uppercase and it would validate, but the error keeps coming up no matter what i do.</p>

<p>Any help would be appreciated.</p>
