index: name javascript functions

Better debugger output.

Signed-off-by: Timothy Gu <timothygu99@gmail.com>