function showPage(list, pageNumber) {
  // scroll to top of page
  window.scrollTo(0, 0);
  // initially, hide all of the list items
  for (let i = 0; i < list.length; i++) {
    list[i].style.display = "none";
  }
  // determine the first student and the last student to be displayed, based
  // on the current page number (page 1 = 0-9; page 2 = 10-19, etc)
  let startStudent = 10 * pageNumber - 10;
  let endStudent = 10 * pageNumber - 1;
  // check if the endStudent value is greater than the number of students in
  // the complete list. If it is, make endStudent = number of students
  if (endStudent > list.length) {
    endStudent = list.length - 1;
  }
  // unhide the 10 list items we want to be visible on the page
  for (let i = startStudent; i <= endStudent; i++) {
    list[i].style.display = "block";
  }

  // call the functions to add the page links pagination to the foot of the page
  // and show the search box at the top of the page
  appendPageLinks(list, pageNumber);
  showSearchBox(completeStudentList);
}
// using startStudent for the first and endStudent for the last
using startStudent for the first and endStudent for the last
using startStudent for the first and endStudent for the last
function showPage(list, pageNumber) {
  window.scrollTo(0, 0);
  for (let i = 0; i < list.length; i++) {
    list[i].style.display = "none";
  }
  let startStudent = 10 * pageNumber - 10;
  let endStudent = 10 * pageNumber - 1;
  if (endStudent > list.length) {
    endStudent = list.length - 1;
  }
  for (let i = startStudent; i <= endStudent; i++) {
    list[i].style.display = "block";
  }
  appendPageLinks(list, pageNumber);
  showSearchBox(completeStudentList);
}
function showPage ( list , pageNumber ) { window . scrollTo ( 0 , 0 ) ; for ( let i = 0 ; i < list . length ; i ++ ) { list [ i ] . style . display = "none" ; } let startStudent = 10 * pageNumber - 10 ; let endStudent = 10 * pageNumber - 1 ; if ( endStudent > list . length ) { endStudent = list . length - 1 ; } for ( let i = startStudent ; i <= endStudent ; i ++ ) { list [ i ] . style . display = "block" ; } appendPageLinks ( list , pageNumber ) ; showSearchBox ( completeStudentList ) ; }
using startStudent for the first and endStudent for the last
using startStudent for the first and endStudent for the last
// scroll to top of page // initially, hide all of the list items // determine the first student and the last student to be displayed, based // on the current page number (page 1 = 0-9; page 2 = 10-19, etc) // check if the endStudent value is greater than the number of students in // the complete list. If it is, make endStudent = number of students // unhide the 10 list items we want to be visible on the page // call the functions to add the page links pagination to the foot of the page // and show the search box at the top of the page