javascript: handle tailcalls for FFI
javascript: assign HOFs properly