title: Uncaught ReferenceError: Cannot access 'Class' before initialization
body: <p>I have little vanila-js project. Chrome's console gives me error from title. Structure of my code is like this:</p>
  <pre><code>&lt;script type=&quot;module&quot;&gt;
  
      import * as THREE from 'https://unpkg.com/three/build/three.module.js';
  
      import { TrackballControls } from 'https://unpkg.com/three/examples/jsm/controls/TrackballControls.js';
  
      var camera, scene, renderer, controls;
  
      init();
      animate();
  
  function init() {
  //code here
  var list_of_objects=generate_first();}
  
   class Color{
  
  
          constructor() {
              this.R=getRandomInt(0,255);
              this.G=getRandomInt(0,255);
              this.B=getRandomInt(0,255);
              this.hex=this.fullColorHex(this.R,this.G,this.B);
          }
  //rest of code}
  
   function generate_first() {
          var list_of_gens=[];
          var color=new Color();}
  
  &lt;/script&gt;
  </code></pre>
  <p>Console indicates on line : <code>var color=new Color();</code>How to fix it? I have no idea why i have this problem.
  PS:Yes, I've searched other topics on stack, but those topics touched frameworks or typescript. None helped me with my bug! That's why I created that topic. Please, don't leave minuses or thumbs down but help me.</p>