The story starts from 1995, The Netscape Navigator browser was very popular and getting very high adoption from companies all over the world. Although it was paid browser, companies were happily paying for it. Then Microsoft jumps in and tried to acquire it but the deal was not happened. Then the browser war started between both the giants. Microsoft built their own version called Internet Explorer and gave it for free. Netscape share price starts declined and company starts making more and more losses every quarter.
On the other side, Java was rapidly gaining traction at that time but it was missing front end part. So, to tackle this and to make web pages interactive Sun microsystem and Netscape came together. They contracted Brendon Eich to design a language that would serve as as a scripting companion of Java. He built it in just 10 days and named it Mocha. Later they change the name from Mocha to LiveScript and finally, JavaScript. It was built just for small scripting tasks. JavaScript has nothing to do with Java. It was marketing strategy to get popularity and thus adoption.
There were so many architectural flaws in JavaScript. There was no feature of live updates at that time and still with those those flaws it was introduced in the market. Netscape continue loosing market share because of rising popularity of Internet Explorer.
"Why would someone pay for Netscape whereas IE was there for free.?"
Finally, Netscape file for bankruptcy and they offer the browser for free and gave it to ECMA.
In 1996 JS brought to ECMA Standards group. ES1 came in 1997, ES2 in 1998, ES3 in 1999. Then conflicts starts in ECMA committee so it took huge time, almost a decade for introducing new standards. Finally much awaited ES5 standard came in 2009 and it blew up the entire web development scenario. we got AJAX, prototype, jQuery, dojo, and mootools ; also npm.
Companies like mozilla started contributed meantime. Later, Yahoo Google, Airbnb, Uber contributed in JavaScript.
In 2009, Ryan Dahl thought Goggle Chrome V8 engine can use JavaScript at backend. He create engine called Node.js . So that after write code in JS for frontend and can use it for backend as well. This was huge turnaround. Uber Cabs company developed first application in Node.js and many companies start using Node.js to save cost in hiring special frontend and backend developer as developers already knew JS for frontend. All they need to do is look into documentation and make apps/ backend libraries, node package managers. Huge open source contribution started. Flipkart, Book My Show, Snapdeal, Red Bus and other companies started using Node.js and it's starting to gain more and more popularity.
Then we got so many libraries, frameworks, npm... on top of JavaScript. Deno (opposite of word Node) was introduced. Mistakes in node.js was trying to solve in deno. Then jQuery library came. It was having best practices from all companies. 30-40% internet still uses jQuery. It's a old technology but suitable for quick and small projects. For big projects it was not well designed. Then backbone.js came, it was suitable web application for big and complex projects. Google came up with their own framework Angular. Facebook wrote their own library, React.js and they open source it (MIT license). React started getting popularity and became famous in very short frame of time because of it's top 3 features. 1. Declarative 2. Component based 3. Write once and use everywhere. Then we have Next.js , Vue.js and other hundreds of libraries.