title: p5 Uncaught (in promise) Error when instantiating an object inside another class
body: <p>I keep getting an error pointing to a line where I create an instance of a class within another class.<br />
  <code>character = new Character(x, y, this.speed);</code></p>
  <p>The error says &quot;sketch.js:33 Uncaught (in promise) ReferenceError: character is not defined&quot; which points to the line above.</p>
  <p>Full error message</p>
  <pre><code> `Uncaught (in promise) ReferenceError: character is not defined
      at Stream.generateCharacters (sketch.js:33)
      at setup (sketch.js:11)
      at p5._setup (p5.js:63048)
      at p5._start (p5.js:62973)
      at new p5 (p5.js:63317)
      at _globalInit (p5.js:62466)`
  </code></pre>
  <p>Here is my code</p>
  <pre><code>let characterSize = 60;
  
  function setup() {
      createCanvas (window.innerWidth, window.innerHeight);
      background(0);
      stream = new Stream();
      stream.generateCharacters();
      textSize(characterSize);
  }
    
  function draw() {
      background(0);
      stream.render();
  }
  
  
  class Stream {
      constructor(){
          this.characters = [];
          this.totalCharacters = round(random(5,30));
          this.speed = random(5,20);
      }
  
      generateCharacters(){
          let y = 0;
          let x = width / 2; 
          for (let i = 0; i &lt;= this.totalCharacters; i++){
              character = new Character(x, y, this.speed);
              character.setToRandomCharacter();
              this.characters.push(character);
              y -= characterSize;
          }
      }
  
      render(){
          this.characters.forEach(function(character) {
              fill(0,255,70);
              text(character.value, character.x, character.y);
              character.setToRandomCharacter();
              character.rain();
          });
      }
  }
  
  
  class Character {
      constructor(x, y, fall_speed){
          this.x = x;
          this.y = y;
          this.value;
          this.fall_speed = fall_speed;
          this.switchInterval = round(random(10,20));
      }
  
      setToRandomCharacter(){
          if (frameCount % this.switchInterval == 0){
              this.value  = String.fromCharCode(
                  0x30A0 + round(random(0, 96))
              ); 
          }
      }
  
      rain(){
          this.y = (this.y &gt;= height) ? 0 : this.y += this.fall_speed;
      }
  }
  </code></pre>