It’s a matter of picking slow-changing technologies: so, not the latest JS framework or whatever, but something like Clojure or Common Lisp that has a track record of maintaining backwards compatibility. And then learn to solve problems in ways that can easily be adapted to solve related problems.