how to create pagination in javascript (1)