![Scroll to top of the page](https://javascriptsource.com/wp-content/uploads/2021/07/Scroll-to-top-of-the-page-702x526.jpg)
In general, you can scroll to a point whose coordinates indicates the distance from it to the top and left side of document. So, the following code scrolls to top of the page:
// window.scrollTo(pageX, pageY);
window.scrollTo(0, 0);
Utilizing this snippet, you can add a button at the bottom of page that allows user to scroll to the top quickly.