Let’s skip right to the chase: I recommend using Steve Yegge’s js2 mode. If you want to read about the other options and how they compared with one another in September 2005, read on! You may also be interested in other things I’ve written about Emacs or on JavaScript. If you find yourself doing substantial hacking on complicated websites, you’ll probably find yourself needing a decent major mode