Retrieving random item in array returns 'undefined' : <p>I used Math.random() to generate a random number between 1 and however many items are in the array <code>availableNumbers()</code></p>

<p>However, when the document's innerHTML is updated with this, suggestedNumber resolved to undefined,</p>

<p>I tried subtracting 1 from randomNumber but that did not make a difference.</p>

<p>I have checked the W3 documentation and it looks like this is implemented correctly...</p>

<p>How would one best go about retrieving a random item from an array? Is there a better implementation than what I sought to implement?</p>

<pre><code>var availableNumbers = ["0", "911"];
function numberSuggestion() {
    var randomNumber = Math.random() * availableNumbers.length -1;
    var suggestedNumber = availableNumbers[randomNumber];
    document.getElementById("suggestion").innerHTML = "How about dialing " + suggestedNumber + "? Don't like this number? Click the button above again!";
}
</code></pre>
