[JS] fix error handling in var_get to not panic - the caller should decide what to do if the var is not found