That is a bit odd, it seems you need to set vw to something to get the typeahead. Try:
var vw:NotesView = database.getView("RandomView")
you'll then get typeahead on vw
To be honest, I never just declare a variable in javascript as I would in Lotusscript for example, I guess there's some fundamental difference there (which someone with more knowledge than I might be able to explain)