Using a meta-language like Typescript (if it's appropriate), and writing a sensible number of tests, employing a consistent code style, documenting what you write, and spending time to actually
design your software properly is the answer.
You can write good software in any language and on any platform. Good code is more about your processes than your choice of tools.