Javascript code - code check
<p>I'm new to Javascript and trying to learn some basics.</p>

<p>Can you please check if I had done the following correctly? If not, please outline what I've yet to do.</p>

<p>I had to:</p>

<ul>
<li>Calculate the user's month of birth as a number where January=0 through to December=11.</li>
<li>Take the string entered</li>
<li>Get the substring being the first three characters</li>
<li>Convert to uppercase</li>
<li>Find the starting location of the three letter abbreviation in the month abbreviations string</li>
<li>Divide this by 3</li>
<li>(This is not the only way to find the month number, but it allows us to practice searching in a string)</li>
</ul>

<p>My code:</p>

<pre><code>var year = prompt('Enter year of birth as a 4 digit integer');  

var month = prompt('Enter the name of the month of birth');
// Chop everything after the first 3 characters and make it lowercase
month = month.substr(0,3).toLowerCase();
// Store your array in months, differently named than the month input
var months = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct",
"nov", "dec"];  

// We then use array.indexOf() to locate it in the array
var pos = months.indexOf(month);
if (pos &gt;= 0) {
// valid month, number is pos
}
</code></pre>
