Paginate Javascript array : <p>I am trying to write a Javascript function that takes an <code>array</code>, <code>page_size</code> and <code>page_number</code> as parameters and returns an array that mimics paginated results:</p>

<pre><code>paginate: function (array, page_size, page_number) {
  return result;
}
</code></pre>

<p>so for example when:</p>

<pre><code>array = [1, 2, 3, 4, 5],
page size = 2,
page_number = 2,
</code></pre>

<p>the function should return: <code>[3, 4]</code>.</p>

<p>Any ideas would be appreciated.</p>
