title: TypeError: string is not a function
body: <p>In the following code, <code>TypeError: string is not a function</code> on line 30 <code>var myColour = new colour(255,255,255);</code> is thrown. Can anyone see what is wrong with the code. Many thanks. </p>
  
  <pre><code>var bodies = [];
  var orbits = [];
  var colours = [
      new colour(45, 45, 45),
      new colour(255, 0, 0),
      new colour(0, 157, 255),
      new colour(77, 250, 81),
      new colour(255, 247, 0)
  ];
  
  function colour(red, green, blue)
  {
      this.red = red;
      this.green = green;
      this.blue = blue;
  };
  
  window.onload = function() {
      var c = document.getElementById("theCanvas");
      var ctx = c.getContext("2d");
      ctx.beginPath();
      ctx.arc(95,50,40,0,2*Math.PI);
      ctx.stroke();
      for (var colour in colours){
          console.log(colour.red);
          console.log(colour.green);
          console.log(colour.blue);
      };
      var myColour = new colour(255,255,255);
      console.log(myColour.red);
      console.log(myColour.green);
      console.log(myColour.blue);
  };
  </code></pre>