title: Slice and map javascript array on multiple items
body: <p>I have a multidimensional array like:</p>
  
  <pre><code>profile = [[2001-05-01, 20], [2001-05-02, 23], [2001-05-03, 18], ...];
  </code></pre>
  
  <p>I create a new array and manipulate the second element of the array by a variable factor.</p>
  
  <p>I'm doing this right now and it works:</p>
  
  <pre><code>function new_ar(origin, start, end, factor) {
    var result = [[]];
    result = origin.slice(start, end).map(function(item){ return [item[0], parseInt(item[1])*factor]});
    return result;
  };
  </code></pre>
  
  <p>I get the desired array:</p>
  
  <pre><code>array2 = [[2001-05-01, 400], [2001-05-02, 460], [2001-05-02, 360], ...]
  </code></pre>
  
  <h1>Problem</h1>
  
  <p>How can I get a new array3, which consists of the first n and last m elements of array2?
  I need to call a function like</p>
  
  <pre><code>function new_ar(origin, start1, end1, factor){
  ...code...
  }
  </code></pre>
  
  <p>for example: I have an array with 200 elements, I need to get a new array with the first 100 and last 50. That means, that I need to say delete from 100 to 149.</p>