The idea of a limit of a function $f$ at a point $x_{0}$ is invented to give answer to the following question:
How does function $f$ behave near the point $x_{0}$?
Note that the question does not ask as to what happens at $x_{0}$ but rather what happens near $x_{0}$. Hence it does not matter whether $f$ is defined at $x_{0}$, but it does matter that $f$ is defined near $x_{0}$. Moreover we would like the function $f$ to be defined at points which are as close to $x_{0}$ as we want. The central idea is that the domain $D$ of $f$ need not contain point $x_{0}$, but it should contain points which are as near to $x_{0}$ as we please.
More formally, a basic prerequisite for defining limit of a function $f$ at a point $x_{0}$ is that for every real number $\delta > 0$ there must exist at least one point $x_{\delta}$ in the domain $D$ of $f$ such that $0 < |x_{\delta} - x_{0}| < \delta$.
When the condition mentioned in above paragraph holds we say that $x_{0}$ is a limit point (accumulation point, cluster point) of $D$.
In general setting the distance $|x_{\delta} - x_{0}|$ is replaced by a metric $d(x_{\delta}, x_{0})$ (which satisfies properties similar to the absolute value function).
For a beginner learning calculus it is better not to indulge in such generalities (of metric / topological spaces), but rather deal with the concrete spaces like set of real numbers. In that case we just say that $f$ needs to be defined in an interval which contains $x_{0}$ in the interior with the possibility that $f$ may not be defined at $x_{0}$.
Note that some authors prefer the general notion and define limits in the following manner.
Let $f: D\to \mathbb{R}$ be a function with $D\subseteq\mathbb{R}$ and let $x_{0}$ be any real number. A real number $L$ is said to be the limit of function $f$ at point $x_{0}$ (denoted by $L = \lim_{x \to x_{0}}f(x)$) if for any given number $\epsilon > 0$ it is possible to find a number $\delta > 0$ such that $|f(x) - L| < \epsilon$ for all points $x \in D$ with $0 < |x - x_{0}| < \delta$.
Based on this definition the limit of the function $f$ in your question is $1$.
The advantage of this definition over the usual one is that it deals with the left-hand and right-hand limits without any special treatment. However it is preferable to stick to the usual definition and define left-hand and right-hand limits separately (especially for a beginner).