How do I stop a web page from scrolling to the top when a link is clicked that triggers JavaScript?

This was a challenge to me at first but when I did some backtest and scan through my entire codes i was able to get the required result I needed when I clicked on the link, and since I have been able to deal with this problem,I wont want you to pass through the stress