title: JavaScript doesn't run in any browser & is enabled - Have replaced document.write for alert and still wouldn't work
body: <p>I'm trying this seemingly simple snippet where the only var 'numero' must return a random number as if it were a dice so the range must go from 1 to 6 and it works BUT it only runs when I insert the whole JavaScript code inside the HTML like a <code>script</code> like this:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!doctype html&gt;
  &lt;html&gt;
  
  &lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;title&gt;JavaScript Dice&lt;/title&gt;
    &lt;script type="text/javascript"&gt;
      var numero = Math.random();
      numero = numero * 6;
      numero++;
      numero = Math.floor(numero);
      document.write("Random dice number is: " + numero + "&lt;br&gt;&lt;br&gt;")
    &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
    &lt;p&gt;This is the main&lt;/p&gt;
  
  &lt;/body&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Although, I get a lot that I must not use <code>document.write();</code>since it's a bad practice (It makes it run slowly or something? I'm still reading my way up to it) and I've tried applying the solutions I've seen in other questions but they're so specific I felt I would've messed up because were hard to implement with such specific elements. So, please, what could I use instead of <code>document.write</code>in this case?</p>
  
  <p>MY BIG QUESTION IS why the code below DOESN'T work?</p>
  
  <ul>
  <li>My first attempt was to link a JavaScript file from HTML as in:</li>
  </ul>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>// The Math Object
  var numero = Math.random();
  numero = numero * 6;
  numero = Math.floor(numero);
  numero++;
  document.write("Random number: " + numero + "&lt;br&gt;&lt;br&gt;");</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!doctype html&gt;
  &lt;html&gt;
  
  &lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;title&gt;JavaScript dice&lt;/title&gt;
    &lt;script src="MathObject.js" language="javascript" type="text/javascript"&gt;
    &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
    &lt;p&gt;This is the main &lt;/p&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>THIS DOESN'T WORK IN ANY BROWSER - I've checked if JavaScript is enabled, I've restarted settings, I've tried Chrome, Edge, Internet Explorer, it only works in the Split/Live view of the code inside DreamWeaver CC 2017 itself which is of no use but I know the code works
  Which just returns:This is the main. </p>
  
  <p>I even replaced the <code>document.write</code>with an alert message just to test it more and it DIDN'T work either unless I run it inside of DreamWeaver or the code editor in here. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>// The Math Object
  var numero = Math.random();
  numero = numero * 6;
  numero = Math.floor(numero);
  numero++;
  alert("Random number: " + numero);</code></pre>
  </div>
  </div>
  </p>
  
  <p>I went crazy trying to seek a solution but decided to implement all JavaScript in HTML. There must be a solution for this or a more appropriate way since I need this to be printed on the document.  </p>
  
  <p>TO CLARIFY:
  - JavaScript only works when it's completely inside the HTML like a script
  - I don't want to print many numbers or a loop. Just one.
  - How can I print something from JavaScript on the document without having to write everything on the HTML
  Any help with all this, please? Thanks in advance ;)</p>