title: Why do I get undefined for each index of my array when I know my values have length
body: <p>I wrote a function that places a value to ["rows"+i] and do know that each one that I set a value has a variable. I cannot figure out why, when I take the length of each and place each as a unique index in the previously empty array has a value of undefined.</p>
  
  <p>My bug would be in this part of the code; I have looked for the bug, but have not yet found it (this is not the whole code, just the part where I think the bug would be:</p>
  
  <pre><code>  var aLength = [];
    for (var i = 0; i &lt; arrays.length; i++)
      aLength[i] = window["rows2"+i].length;
    return aLength;
  } // this is where my ends
  console.log(width(arrays));
  </code></pre>
  
  <p>//[undefined, undefined, undefined, undefined]</p>
  
  <p>full code:</p>
  
  <pre><code>var arrays = [[111111, 22222, 333], [444444444, 534334, 63], [73, 83748395, 9343], [279571, 327894598571490581, 34815, 2]];
  var width = function(arrayOfArrays){
    var a = arrays.length;
    for(var i = 0; i &lt; arrays.length; i++)
      window["array"+i] = arrays[i];
    for(var i = 0; i &lt; arrays.length; i++){
      window["rows"+i] = window["array"+i];
      window["rows"+i].reduce(function (onea, twoa){
        return window["rows2"+i] = Math.max(onea, twoa);
      }, []);
      console.log(window["rows2"+i]);
    }
    var aLength = [];
    for (var i = 0; i &lt; arrays.length; i++)
      aLength[i] = window["rows2"+i].length;
    return aLength;
  }
  console.log(width(arrays));
  //111111
  //444444444
  //83748395
  //327894598571490560
  //[undefined, undefined, undefined, undefined]
  </code></pre>
  
  <p>Thanks! :) </p>