Why Javascript
Javascript is a popular language because it has access to the browser and can react or responde to user interactions locally, without the need of sending a request to the server.
That in not true in many other web programming languages, like Ruby, as they run on the server side only. In that case, any interaction that needs to show anything new to the user has to necessarily generate a request to the server, which will then get that information, use it's logic, build a new page accordingly and then send the HTML and CSS to the user's browser, that is responsible only to render the page and show the result back to the user.
Javascript, in the other hand, can do much of the processing locally in the browser without having to send a request to the server and then waiting it to respond. As a result, this means faster response time and a much better user experience, specially on web apps that are very dynamic, phones or clients with slow or unstable connectivity.
Javascript used to run in the browser only, so it would still depend on other programming languages as Ruby or PHP to deal with the server side. However, Javascript has grown a lot since it was created and nowadays it works on the server side also, with node.js. Along with that, JS in now able to locally access not only the browser, but also the GPU, storage and other parts of your computer, allowing programmers to buld a lot more powerfull web applications on top of it.
And there is more. Javascript is capable of running smoothly in several different platforms, like phones and tablets, and it can even run apps offline. Some even say that Javascript will eventually kill native apps .
Limitations?
Even though Javascript is a teenager that has been growing and changing fast, there are some important things it can not do yet and it has a lot to grow.
For example, Javascript can not acess pages in different domains, access databases or write to files on the server by itself. Of course, that does not mean it can't do it, but it will need a little hand through AJAX scripts to do that kind of thing.
Javascript`s future is looking bright though, and many big players in the market like Google, Apple and Microsoft have been investing heavily in the language and making it important part of their products.