title: extracting last elements from 2d array javascript
body: <p>Ok so I'm trying to create a very basic machine translation program in JavaScript as a learning project.  I am breaking sentences into 2D arrays ala...</p>
  
  <pre><code>function string2TwoD(sentence){
      var periodless = sentence.replace(/^[.\s]+|[.\s]+$/g, "");
      var splitSen = periodless.split(" ");
      splitArray = [];
      var i;
      for (i = 0; i &lt; splitSen.length; i++){
          splitArray[i] = splitSen[i].split("");
      }
      return splitArray;
  }
  </code></pre>
  
  <p>now I am trying to extract the last letter from each second level array and stick them in another array that I can work with later.
  So far the only thing I've come up with is...</p>
  
  <pre><code>var workWith = sting2TwoD("This here is a sentence boy.");
  var completeSen = string2TwoD("This here is a sentence boy.");
  var i;
  var popped = [];
      for (i = 0; i &lt; workwith.length; i++){
          popped += workwith[i].pop();
      }
  var poppedArray = popped.split("");
  console.log(poppedArray);
  console.log(completeSen);
  </code></pre>
  
  <p>This seems like a crappy solution to me as I am forced to create a second copy of the original array just to hold on to the original value of my string2TwoD function.  There must be a better way to access the ending values of the second level arrays (in many cases I will need the last two elements of the arrays as I am actually trying to extract adjective endings(this will be translating from German into English)).  I've tried doing it with multiple for loops but I just can't seem to get it to pull out the correct values.  Any suggestions?  Forgive me, I am noob.</p>