Trying to create a word scrambler which takes text from a text box, scrambles the letters, and repeats them in a different text box. Code must use a loop to distribute the text across an array of letters. Once I reach the Math.floor Object, I'm confused as to how to proceed.
Relevant Code:
    <script type="text/javascript">
    var word = document.getElementById("input").value;
    var wordLength = word.length;
    var scrambled = "";
    for (var i = 0; i < wordlength; i++) {
        var charIndex = Math.floor(Math.random() * word.length);
        scrambled += word.charAt(charIndex);
        word = word.substr(0, charIndex) + word.substr(charIndex + 1);
    }
    document.getElementById("output").value = scrambled;
    }
    </script>
    <head>
    <body>
    <form>  
    <input type="text" name="input" id="input" value="" maxlength="10"> <input type="text" name="output" id="output" value="" disabled="true"><br/>
    <input type="button" name="generate" value="Generate" onClick="Scramble(this.form)">
    </form>
    </body>
    </html>
 
     
     
    