Created
December 13, 2019 10:11
-
-
Save CMarzin/af3a5f060f2a95169f72a65f474bca20 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function paginate (array, page_size, page_number) { | |
--page_number; // because pages logically start with 1, but technically with 0 | |
return array.slice(page_number * page_size, (page_number + 1) * page_size); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment