From what I understand, a function has an inverse if and only if such function is a bijection.
So if we consider $f(x)=\frac{1}{x}$, it is clear that $f$ is not a bijection since $f$ is not surjective (because its codomain is $\mathbb{R}$, which is not equal to its range $\mathbb{R}$\{$0$} ).
However, looking at this website here (https://www.mechamath.com/algebra/how-to-know-if-a-function-has-an-inverse/) it mentions that you can do a "horizontal line test" to determine if a function has an inverse - i.e. if you can draw a horizontal line on a sketch of $y=f(x)$ that passes through more than one point, then the function doesn't have an inverse.
Using this horizontal line test on $f(x)=\frac{1}{x}$, no horizontal line can be drawn which crosses through two points on a sketch of $y=\frac{1}{x}$ and so this would suggest that an inverse does exist for $f(x)=\frac{1}{x}$ and that this would be $f^{-1}(x)=\frac{1}{x}$.
So my question is simply whether $f(x)=\frac{1}{x}$ does, or doesn't, have an inverse?