The Javascript engine is built into the browser, and it works on the instantiated DOM (document object model) in the browser. That's why it's run in the browser.
Kees
Why is it best to run JavaScript from a browser rather than a server? Anyone have an examples why?

Chowhound
Comic Vine
GameFAQs
GameSpot
Giant Bomb
TechRepublic