title: Slice/Section of two dimensional array in JavaScript
body: <p>I need to take slice of 2d array with binary code. I need to specify where I want to start and where will be the end. </p>
  
  <p>For now I have this code, but I'm pretty sure it's wrong:</p>
  
  <pre><code>var slice = [[]];
  var endx = 30;
  var startx = 20;
  var starty = 10;
  var end = 20;
  for (var i = sx, a = 0; i &lt; json_data.length, a &lt; ex; i++, a++) {
    for (var j = sy, b = 0; j &lt; json_data[1].length, b &lt; ey; j++, b++)
      slice[a][b] == json_data[i][j];
  }
  </code></pre>
  
  <p><code>json_data</code> is an array in format:</p>
  
  <pre><code>[0,0,0,0,0,1,...],[1,1,0,1,1,0...],...
  </code></pre>
  
  <p>it is 600x600</p>