Well, this question has different ways it can be answered. Here's the approach I'd take to be versatile:
1. Javascript because there is no other choice for the browser. Even things that compile to JS will occasionally have you debugging the transpiled code to figure out what went wrong;
2. C. This is really C or C++ as you need something that's close to the metal and on some occasions nothing else will do. C probably edges out C++ in terms of versatility here;
3. Honestly, it'd probably be Java, which makes me sad. I'd like it to be Go but Java is just too ubiquitous and useful to ignore. It covers you for both a ton of web apps and Android development.
An alternative to (3) is really Python. The above list doesn't include any scripting languages, which is a weakness. Python covers this but really loses (first class) Android support. I don't like Python for large systems either.
For fun it might look a lot different eg Go, Swift and yes even C++. It really depends on what your goals are.
1. Javascript because there is no other choice for the browser. Even things that compile to JS will occasionally have you debugging the transpiled code to figure out what went wrong;
2. C. This is really C or C++ as you need something that's close to the metal and on some occasions nothing else will do. C probably edges out C++ in terms of versatility here;
3. Honestly, it'd probably be Java, which makes me sad. I'd like it to be Go but Java is just too ubiquitous and useful to ignore. It covers you for both a ton of web apps and Android development.
An alternative to (3) is really Python. The above list doesn't include any scripting languages, which is a weakness. Python covers this but really loses (first class) Android support. I don't like Python for large systems either.
For fun it might look a lot different eg Go, Swift and yes even C++. It really depends on what your goals are.