title: JS: How to count in letters
body: <p>I want to be able to count in base 26, but only with the letters of the alphabet.</p>
  
  <p>I can cover the basics like <code>A + 1 = B</code> and <code>Z + 1 = AA</code>, but i want it to work for very long "numbers" like <code>AZZEBERBZZ</code></p>
  
  <p>Currently i have the following code in JavaScript</p>
  
  <pre><code>function getNextColumn(currentColumn) {
      currentColumn = currentColumn.toUpperCase();
      let lastLetterCode = currentColumn.charCodeAt(currentColumn.length - 1);
  
      if(lastLetterCode &lt; 90) {
          return currentColumn.slice(0, -1) + String.fromCharCode(lastLetterCode + 1);
      } else {
          return currentColumn.slice(0, -1) + "A";
      }
  }
  </code></pre>
  
  <p>But the issue here is that when i'm at <code>AZ</code> it just returns <code>AAA</code> instead of <code>BA</code></p>
  
  <p>How can i solve this?</p>
  
  <p>EXTRA CONTEXT:</p>
  
  <p>I need the function <code>getNextColumn</code> because I use this function to loop over an object created from an excel sheet, where to columns are counted in <code>base26</code> but only with letters and no numbers</p>