Page Through Results

Write the code, see it run, pass the checks.

The problem

  • medium
  • Code
  • Pro

The starter has 12 results. Show them 5 at a time, with "Previous" and "Next" buttons and a line reading "Page 1 of 3". Previous is disabled on the first page and Next on the last. Work out the number of pages from the results, not by writing 3.

Your code must pass

  • Shows the first 5 results on page 1
  • Next shows the next 5 and updates the page line
  • The last page shows the last 2 results
  • Previous and Next are disabled at the ends