JavaScript is used on almost every modern website, and it has a wide array of applications. For instance, it’s used to open a menu when you click a menu button on your phone, to show a larger version of an image when you click it, or to load more posts at the bottom of a page without forcing your browser to do a hard reload.
Those are examples of pretty simple uses of JavaScript. The development of new libraries built on top of the language, like Vue and React, has made it possible to build increasingly complex systems with JavaScript at their core. The latter of the two libraries, React, is developed by Meta, the company behind Facebook, and they use it for almost all of the front-end interactions on their services. React is also the backbone of the block editor in WordPress.
As a user of WordPress, you will probably not have any direct interactions with JavaScript, but it is one of the core technologies on top of which WordPress is built.