After writing tones of code you’ll get bored to write the same (helper)functions over and over again for each new project. Functions to short tables, scroll to top, detect mouse position, show pop-up boxes and more are very useful on each public project. I’m not giving you optimized code here, instead I’m showing some basic stuff in order to get inspiration! It is better in my opinion not to use jQuery but for the sake of simplicity I’ll use this library here.
At the bottom of this article I referance some great articles with great javascipt helper functions.