title: How to separate variables in to arrays of 3?
body: <p>So What this is supposed to do, minus the mouseenter/mouseleave functions, is to take user input, divide it in to an array with 3 letters in each array placement (ex. User input abcdef... will turn in to abc, def,...). I read a different post on stack overflow, (<a href="https://stackoverflow.com/q/4017671">How do you split a string at certain character numbers in javascript?</a>). However, I can't quite get this to function in my following code.</p>
  
  <p>Here is my script.js:</p>
  
  <pre><code>$(document).ready(function() {
      $('#button_translate').mouseenter(function() {
          $('#button_translate').fadeTo('fast', 1);
      });
      $('#button_translate').mouseleave(function() {
          $('#button_translate').fadeTo('fast', 0.7);
      });
      $('#button_clear').mouseenter(function() {
          $('#button_clear').fadeTo('fast', 1);
      });
      $('#button_clear').mouseleave(function() {
          $('#button_clear').fadeTo('fast', 0.7);
      });
      $('#button_translate').click(function() {
          var dna = $('input[name=dna]').val();
          var dna = dna.toUpperCase();
          function allBases(text) {  
              var bases = /^[ACGT]+$/;  
              if(text.match(bases)) {  
  
                  var arr = Array.prototype.slice.call(dna), output = [];
                  while (arr.length) output.push(arr.splice(0, 3).join('');
                  document.write(arr + " is a DNA sequence.");
  
              }
              else
              {  
                  document.write(dna + " is not a real DNA sequence.");
              }  
          }
  
          allBases(dna);
  
      });
  });
  </code></pre>