for history, you should read the wikipedia page -
JavaScript - Wikipedia, the free encyclopedia
Javascript works client-side as opposed to server-side so you can do things without the page having to be sent back to the server, such as validate form input for example.
There are many javascripts available to do a zillion different things, from display the current date and time on your page, to mouseovers and popups, it can react to events like a button click, control the status bar - too much to list.
Here's a starter tutorial at W3 Schools
JavaScript Introduction