javascript scroll to top

JavaScript
//Instant scroll to top of page
window.scrollTo(0, 0);window.scroll({
 top: 0, 
 left: 0, 
 behavior: 'smooth' 
});$("a[href='#top']").click(function() {
  $("html, body").animate({ scrollTop: 0 }, "slow");
  return false;
});	$("#scroll_icon").click(function()
	{
		jQuery('html,body').animate({scrollTop:0},2000);
	})window.scrollTo(x-coord, y-coord);
Source

Also in JavaScript: