title: Object Constructor with for loop doesnt work
body: <pre><code>var test=new network([2,3,1]);
  test.reset();
  console.log(test.layers);
  function network(args){
      this.layers=[];
      this.numberoflayers=args.length;
      this.reset=
      function(){
          for(i=0;i&lt;this.numberoflayers;i++){
              this.layers.push(new layer(args[i],args[i+1]));
              this.layers[i].reset();
           }
      }
  }
  function layer(num,numlayer){
      this.nodes=[];
      this.reset=
      function(){
          for(i=0;i&lt;num;i++){
              this.nodes.push(new node(numlayer));
              this.nodes[i].reset();
          }
      }
  }
  function node(num){
      this.weights=[];
      this.reset=
      function(){
          for(i=0;i&lt;num;i++){
              this.weights.push(0);
          }
      }
  }
  </code></pre>
  
  <p>This code is my attempt at creating a neural network. The problem is that when I run the code, it only creates the first object for each array instead of looping through all the objects it should create. For example, the test.layer array should contain three layer objects but it stops after the first one. Same with the layer.nodes and the nodes.weights.
  Thanks in advance for your help.</p>