Camelcase using split( ) twice in Javascript
<p>I am trying to make a function to split a sentence into words then split the words into characters and capitalize the first letter of each word. Yes it's homework and after many tries I can not get it to work. One thing tripping me up is using split() twice.</p>

<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
&lt;head&gt;
    &lt;title&gt;Sentence Case Conversion&lt;/title&gt;
    &lt;script type= "text/javascript"&gt;
    /* &lt;![CDATA[ */
    /* ]]&gt; */
    &lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
    &lt;form name= "convertText"&gt;
        &lt;p&gt;Enter text to convert to sentence case:&lt;/p&gt;
        &lt;input type ="text" size ="120" name="userInput"&gt;
        &lt;/br&gt;
        &lt;/br&gt;

        &lt;input name= "Submit" onclick= "sentenceCase()" value= "Convert Text" type= "button"&gt;
    &lt;/form&gt;

        &lt;/br&gt;
        &lt;/br&gt;
        &lt;/br&gt;

        &lt;form name= "ouputText"&gt;
        &lt;p&gt;Here is your converted text:&lt;/p&gt;
        &lt;input type="text" size="120" name="result"&gt;
            &lt;script type= "text/javascript"&gt;
            /* &lt;![CDATA[ */
            function sentenceCase() {

                var userInput = document.forms[0].userInput.value;        //get user input
                var wordArray = userInput.split(" ");                     //split user input into individual words

                for (var i=0; i&lt;wordArray.length; i++) { 
                     var characterArray = wordArray[i].split("");
                     characterArray[0].toUpperCase();
                     wordArray[i]=characterArray.join;
                }

            /* ]]&gt; */
            &lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
