title: What does this javascript game code do?
body: <p>I was watching a video on javascript and came across this:</p>
  
  <pre><code>var matrix = [
  [0,0,0],
  [0,1,0],
  [1,1,1],
  
  ];
  
  
  matrix.forEach(function(row, y){ 
  row.forEach(function(value, x){
      console.log(value);
      if( value != 0){
          context.fillStyle = "red";
          context.fillRect(x, y, 1, 1);
          }
  
      });
  });
  </code></pre>
  
  <p>I was wondering how the forEach part of the code works. Does the row variable become equal to the matrix array, what do the x and y variables equal. I just want to get my head around it.</p>
  
  <p>Thanks in advance,
  Asher.</p>