I work on a daily basis in javascript (server side jscript and node, and client side browser/extensions), vbscript, php and t-sql (and occasionally golang and ruby).
I mostly handle it by trying to stay in one "mode" for as long as possible. For example, I'll try to get all of my vbscript code done first, then the j(ava)script interop code, which are both server side, then I'll write the needed database code, then move to working in the browser once I have a stable api to work with. I try not to mix them unless I'm doing maintenance that requires slicing through all the layers.
I keep the documentation for all of the systems open so that I can quickly reference the stuff I forget. I just try to keep the major stuff "in cache", and then I remember the broad strokes and look that stuff up when needed. In addition to the official documentation, I have a directory of old code examples that I can lean on when I have to remember how to do some uncommon or rare things.
Even then, I still often use brackets in my vbscript and "end functions" in my javascript/php code. It's just a hazard of working in multiple languages environments that I've learned to live with.