6. Given the function $f(x)$ satisfies
$$
f(x)=\left\{\begin{array}{ll}
x-3, & x \geqslant 1000 ; \\
f(f(x+5)), & x<1000 .
\end{array}\right.
$$

Then $f(84)=$ . $\qquad$
6.997.

Let $f^{(n)}(x)=\underbrace{f(f(\cdots f(x)))}_{n \uparrow}$. Then
$$
\begin{aligned}
& f(84)=f(f(89))=\cdots=f^{(184)}(999) \\
= & f^{(185)}(1004)=f^{(184)}(1001)=f^{(183)}(998) \\
= & f^{(184)}(1003)=f^{(183)}(1000)=f^{(182)}(997) \\
= & f^{(183)}(1002)=f^{(182)}(999)=f^{(183)}(1004) \\
= & f^{(182)}(1001)=f^{(181)}(998)=f^{(182)}(1003) \\
= & f^{(181)}(1000)=\cdots=f(1000)=997 .
\end{aligned}
$$

Therefore, $f(84)=997$.