Why do you think JavaScript cannot handle it? If you reach the million lines of code you probably have a really modular application, otherwise it's unmaintainable in any language. Being modular it can be sub-divided in many small layers which are the size of a jQuery library.
I think your experience with JavaScript comes from reading code made by bad developers. If your software is written by good people it will be maintainable even in JavaScript.