Creating a random number using JavaScript and returning in HTML without using form
<p>Is it possible to generate a random number from JavaScript to HTML using button <code>onclick</code> but return it through a <code>&lt;div&gt;</code> ? I have looked at other similar questions but they all seem to use either <code>&lt;input&gt;</code> or <code>&lt;form&gt;</code>. I am not getting any errors in my browser, when I try this code but the output is coming from the <code>&lt;div&gt;</code> saying 'undefined' as opposed to a number so I'm obviously not defining <code>number</code> but I'm just a bit confused by JavaScripts syntax. </p>

<h1>/// HTML ///</h1>

<pre><code>&lt;html&gt;
&lt;head&gt;
&lt;script type="text/javascript" src="randRandomScript.js"&gt;
&lt;/script&gt;    
&lt;/head&gt;

&lt;body&gt;

 &lt;button name="randNumberButton" onclick="randNumberScript()" &gt;Click for Number&lt;/button&gt;

&lt;div id="number"&gt;&lt;/div&gt;
&lt;/body&gt;

&lt;/html&gt;
</code></pre>

<h1>/// JavaScript ///</h1>

<pre><code>var randomNumberObject = math.floor(math.random()*10);

 function randNumberScript () {

document.getElementById("number").innerHTML = randomNumberObject;

}
</code></pre>