title: Returning array from arrow function in JavaScript
body: <p>I'm making a solar system generator in JavaScript in p5.js and I want to return an array of rgb values from an arrow function but It doesn't work. The star is white instead of yellow, orange or red.</p>
  
  <pre class="lang-js prettyprint-override"><code>class Star {
    constructor(x, y) {
      this.x = x;
      this.y = y;
      this.size = random(50, 70);
      this.color = () =&gt; {
        let colorChoice = floor(random(6));
        switch(colorChoice) {
          case 0: case 1: case 2: case 3:
            return [255, 255, 0];
            break;
          case 4:
            return [255, 150, 0];
            break;
          case 5:
            return [255, 0, 0];
            break;
        }
      }
    }
  
    show() {
      noStroke();
      fill(this.color[0], this.color[1], this.color[2]);
      circle(this.x, this.y, this.size);
    }
  }
  </code></pre>
  
  <p>Is there something wrong in the function itself or elsewhere?</p>