Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Practice Data Pagination!
You have completed Practice Data Pagination!
Preview
This video shows one way of dynamically creating and inserting the pagination buttons to the DOM.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You can see my solution and
then go back and try it again.
0:00
All right, let's do this.
0:03
For step one, I created a variable
named number of buttons.
0:05
I divided the length of the array passed
to this function by the authorsPerPage
0:09
variable, then I rounded
the number up using Math.ceil.
0:14
Next, I started a for loop to the length
of my number of buttons variable.
0:18
Since we don't want to start our
pagination buttons with zero,
0:23
I decided to start my index variable at
one and loop as long as it's less than or
0:26
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up