js: Don't take address of variable that goes out of scope