JavaScript and Java are completely different languages, both in concept and design. JS was invented by Brendan Eich in 1995, and became an ECMA standard in 1997. ECMA-262 is the official name, ECMAScript 5 (JavaScript 1.8.5 – July 2010) is the latest standard.
When a user requests an HTML page with JavaScript in it, the script is sent to the browser and it’s up to the browser to do something with it.
It has a variety of different uses in web technology, such as:
HTML Attribute changing
Search Box Auto-complete (e.g. Google, Bing, Twitter, Facebook etc.)

Games
Automatically updating information on a web page without user interaction (e.g. Football scores, Twitter feed, Facebook Timeline.)
Data Validation (e.g. checking information is correct on a sign up form.)