Over the years people have developed an unbelievable number of coding languages. They all do pretty much the same job in pretty much the same way.
That's one way to say that you don't know a lot about programming languages.
Personally I have coded in Mercury Autocode, COBOL, FORTRAN, PL/1, LISP, Assembler, PERL, basic, C, C++ and JavaScript plus probably some others I have forgotten.
Sadly, there's no functional language in this list except LISP.
JavaScript’s longevity is assured for one reason. Browsers only support JavaScript.
Incorrect, browsers also support WebAssembly, which allows many languages (including C, C++, Rust, zig, Go, and many more) to run in the browser. And even without WebAssembly, languages can be transpiled to JavaScript, so you don't need to code in JavaScript to run your code in the browser. Languages that can be transpiled to JavaScript include TypeScript, CoffeeScript, Reason, Elm, PureScript, Dart, Kotlin, Scala, Nim, ...
However JavaScript has a flaw.
Not just one. Every programming language is flawed. Some languages have no type safety, some have no memory safety, some have no thread safety (or no multithreading to begin with), some are too slow for certain applications, some have an incomprehensible or verbose syntax, most support only one (sometimes two) paradigms (functional / imperative / object-oriented / logical), some have no proper module system, or no control over mutability, or visibility, or memory allocation, or side effects... some lack ergonomic error handling, or cooperative multitasking facilities such as coroutines, or generators, or macros, or reflexion...
If you don't appreciate the vast design space that is programming languages, of course you won't understand why there are so many of them.