# I don't know the reason of this error

**URL:** https://discourse.processing.org/t/i-dont-know-the-reason-of-this-error/44169
**Category:** Coding Questions
**Tags:** homework
**Created:** [March 28, 2024, 2:27am UTC](https://discourse.processing.org/t/i-dont-know-the-reason-of-this-error/44169 "2024-03-28T02:27:52Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![silverhee](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@silverhee](https://discourse.processing.org/u/silverhee)
#### Post date: [March 28, 2024, 2:27am UTC](https://discourse.processing.org/t/i-dont-know-the-reason-of-this-error/44169/1 "2024-03-28T02:27:53Z")

</div>

hi. I want to make ‘matrix rain’ in p5js  
but…

```auto
let symbols = [];
let symbolSize = 26;

function setup() {
  createCanvas(window.innerWidth, window.innerHeight);
  background(0);
  let x = 0;
  for (let i = 0; i <= width / symbolSize; i++) {
    let symbol = [];   
    
    symbol = new Symbol(x, random(-1000, 0));
    symbol.generateSymbols();
    symbols.push(symbol);
    x += symbolSize;
  }
  textSize(symbolSize);
}

function draw() {
  background(0, 150);
  symbols.forEach(function(symbol) {
    symbol.render();
  });
}

class Symbol {
  constructor(x, y, speed) {
    this.x = x;
    this.y = y;
    this.value='';
    this.speed = speed || random(5, 20);
    this.switchInterval = round(random(2, 20));
  }

  generateSymbols() {
    this.value = String.fromCharCode(
      0x30A0 + round(random(0, 96))
    );
  }

  render() {
    fill(0, 255, 70);
    text(this.value, this.x, this.y);
    this.rain();
    if (frameCount % this.switchInterval == 0) {
      this.generateSymbols();
    }
  }

  rain() {
    this.y = (this.y >= height) ? 0 : this.y += this.speed;
  }
}

```

symbol = new Symbol(x, random(-1000, 0));  
Here is an error message in the code  
Why? ㅜㅜ I don’t know the reason…

TypeError: Cannot read properties of undefined (reading ‘\_report’)  
at undefined:2:37105

Pleas help me~~

---

<div class="post-metadata">

### Author: ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)
#### Post date: [March 28, 2024, 5:36am UTC](https://discourse.processing.org/t/i-dont-know-the-reason-of-this-error/44169/2 "2024-03-28T05:36:49Z")

</div>

> **[p5.js Web Editor](https://editor.p5js.org/cg3320/sketches/Hk4f_Jg9Q)**
>
> A web editor for p5.js, a JavaScript library with the goal of making coding accessible to artists, designers, educators, and beginners.

[![](https://img.youtube.com/vi/S1TQCi9axzg/hqdefault.jpg "Guest Tutorial #4: Matrix Digital Rain in p5.js with Emily Xie") ](https://www.youtube.com/watch?v=S1TQCi9axzg)

[https://xie-emily.com/generative\_art/green\_rain.html](https://xie-emily.com/generative_art/green_rain.html)

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [March 28, 2024, 7:35am UTC](https://discourse.processing.org/t/i-dont-know-the-reason-of-this-error/44169/3 "2024-03-28T07:35:25Z")

</div>

> [@silverhee](#):
>
> ` new Symbol(x, random(-1000, 0));`

The number of parameters is wrong  
You forgot speed

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [March 28, 2024, 7:36am UTC](https://discourse.processing.org/t/i-dont-know-the-reason-of-this-error/44169/4 "2024-03-28T07:36:47Z")

</div>

> [@silverhee](#):
>
> class Symbol {  
> constructor(x, y, speed) {

It must match the number of parameters that you have here

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [March 28, 2024, 8:42am UTC](https://discourse.processing.org/t/i-dont-know-the-reason-of-this-error/44169/5 "2024-03-28T08:42:43Z")

</div>

Hello @silverhee,

You did not format your code.

Please read:

> [@Guidelines—Asking Questions](https://discourse.processing.org/t/guidelines-asking-questions/2147/1):
>
> Summary (TL;DR) Ask complete questions to get better answers! Be specific. For example: I want to load an image. I tried using createImg() , and I expected the image to be on canvas, but what happened instead was the image showing up below the canvas. Isolate your problem and work in small steps. Share only the code directly related to your problem if it is part of a bigger project, and if something isn’t working, try the smallest code that could do the thing you want. Can we run your code to …

I get these errors in the [p5.js Web Editor](https://editor.p5js.org/):

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/e/6/e60f0b493c815cdad5069575fa770fb94e5af646.png)

Try changing the class name to something other than _Symbols_ (I used _Zymbols_) and got the following:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/b/c/bc0110c233ee3e1cda3013327d1e37791447cb0b.png)

There may have been a conflict with the name of the class you used:  
_[Symbol.iterator - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/iterator)_

Keep at it!

`:)`
