Why is JavaScript used on webpages?
The short answer
JavaScript implements browser behavior such as button actions, filtering results, and updating parts of a page.
How it works
HTML can display content and links alone, while JavaScript helps change content based on state. Important information should remain readable if scripts fail.
A familiar example
A page using JavaScript does not necessarily perform every operation on a server.