I think there's a law something like this $\lim_{x\to a}f(g(x))= f(\lim_{x\to a} g(x))$ but it has two conditions:
Limit of g(x) at $a$ should exist.
$f(x)$ should be continuous at $\lim_{x\to a} g(x)$.
In the picture, I don't think $f(x)$ is continuous so how would I find this limit?
There's an answer given in the book but I don't understand it. Any help would be appreciated.
Edit : The answers already given are understood by me, but I am not sure if they are correct, so if you could give a specific credible answer, I'd appreciate that. Thanks!

I remember I wrote the law you mentioned on blackboard with chalk many years ago.
Let us define the restricted function $\tilde f:[1,\infty)\to\Bbb R$ by $\tilde f(x)=3.$ Then $\tilde f$ is continuous and $(f\circ g)(x)=(\tilde f\circ g)(x)$ for all $x\in\Bbb R$. Applying the law, we have $$\lim_{x\to 2} f(g(x))=\lim_{x\to 2} \tilde{f}(g(x))=\tilde{f}(\,\lim_{x\to 2}g(x)\,)=\tilde{f}(1)=3. $$