Created
September 29, 2020 04:21
-
-
Save mezerotm/eb183a87fa6886e920ae31bf990a08ea to your computer and use it in GitHub Desktop.
A for loop for pagination
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
let numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | |
let page = 2 | |
let limit = 5 | |
for(let i = (page * limit - limit); i < numbers.length && i < (page * limit); i++) { | |
console.log(numbers[i]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment