title: "Look and say sequence" in javascript
body: <blockquote>
    <p>1 <br>
    11<br>
    12<br>
    1121<br>
    122111<br>
    112213<br>
    122211<br>
    ....
    <br>
    I was trying to solve this problem. It goes like this.
    I need to check the former line and write: the number and how many time it was repeated.
    <br> ex. 1 -> 1(number)1(time)</p>
  </blockquote>
  
  <pre><code>var antsArr = [[1]];
  var n = 10;
  
  for (var row = 1; row &lt; n; row++) { 
    var lastCheckedNumber = 0;
    var count = 1;
    antsArr[row] = [];
  
    for (var col = 0; col &lt; antsArr[row-1].length; col++) {
  
      if (lastCheckedNumber == 0) {   
          lastCheckedNumber = 1;
          antsArr[row].push(lastCheckedNumber);
  
      } else {
  
          if (antsArr[row-1][col] == lastCheckedNumber) {
              count++;
  
          } else {
              lastCheckedNumber = antsArr[row-1][col];
          }
  
      }
  
    }
    antsArr[row].push(count);
    antsArr[row].push(lastCheckedNumber);
  }
  
  
  
  for (var i = 0; i &lt; antsArr.length; i++) {
    console.log(antsArr[i]);
  }
  </code></pre>
  
  <p>I have been on this since 2 days ago.
  It it so hard to solve by myself. I know it is really basic code to you guys.
  But still if someone who has a really warm heart help me out, I will be so happy! :></p>