The way that seemed to work best for me was to create small hobby web sites that do one specific task and use the javacript to create the user experience that I wanted. Usually a small tool or something, sometimes for a game. I'd write do it the best way I knew how at the time.
Then every few years I look at them again and I can see how I wrote it then, and I'll rewrite the javacript part again the best way I know how now.
It's great for perspective. Sometimes your past self makes you cringe, but other times they deserve a high five.