Over the years, I've had the pleasure of working with some incredibly talented people. Some of them have been so knowledgeable about a particular language or framework that they've been a bit frightening. As in, how can one person possibly know that much?
I'm not one of those people. There are a lot of reasons for this, I think. For one thing, it's just how I'm wired. I'm interested in pretty much everything around me. Since I was a kid I've been a near-constant reader, and my parents were only too happy to throw books at me. That, combined with a good imagination and halfway decent memory, and you end up with someone who has pretty wide-ranging interests.
More specicially, it's just the path my career has taken. In late 2000 I was hired to work at a company where the main language was Java. By early 2001 I was switched to be a backend developer. Problem was, I didn't know much Java, and knew practically nothing about EJB. So my manager gave me a book on EJB on a Friday, and gave me some basic tasks on Monday. I was there until 2006, ending up on a technical architecture team. Along the way I did a lot of Java, hacked COBOL, and even wrote Python code that parsed COBOL and spit out Java. That still stands out as some of the craziest stuff I've worked on.
In 2007 I was hired to do C#. I had never worked in C#, but off I went and did pretty well.
The end result of all this is that, while I'm not the world's foremost expert in anything, I have a lot of tools I can pull from. There's a lot of experience to be gained in learning a lot of new skills over a couple of decades.
So when a problem comes up, I tend to be able to approach it from many different angles. Sometimes I even pull from the time I spent doing construction work in my teens, working with my dad. In fact, I think my dad was the same way, and I learned how to learn, in large part, from him.
This is why I tell folks who want to code, to just find what interests them. Learn the basics, and learn how to learn a language or framework. Everything else will change, and when it does you'll be better positioned to keep pace. It's a skill that has served me pretty well over the years.