I've done work for a fair number of banks and insurance companies, and my anecdotal impression is that there is always a java system siphoning data from the cobol systems...
Both stay around for the same reason: backwards compatability and a stable api+abi.
If you find and old Java system it's often trivial to do changes and recompile. Even a few years old C program is often problematic due to changes in the OS or libraries.
I have no idea if it's possible to compile a couple of years old js code...
... but modern js almost always have a build step.
But yeah, the fair deal of time I have spent on fixing old web pages was more related to fixing the html and CSS and just minor problems related to js.
Both stay around for the same reason: backwards compatability and a stable api+abi.
If you find and old Java system it's often trivial to do changes and recompile. Even a few years old C program is often problematic due to changes in the OS or libraries.
I have no idea if it's possible to compile a couple of years old js code...