In the last couple of years I had lots of discussions with people about one specific topic: what do you do with jQuery spaghetti code in legacy applications. We all have been there in one point of our career. For me the answer was pretty straight forward. There are three ways out of it. None of them is easy, but the result will hopefully be worth it. There is only one reason not to fix this problem: nobody needs to touch that part of the application and it works fine as is. If you need to touch the code regularly, you have to change something. But what? And how?
It basically boils down to the following solutions:
Change the team structure