Continuous function on a closed set is determined by its values on a countable subset I want to ask for a proof-reading of my solution to the following problem.

For any closed subset $X$ of $\mathbb{R}^n$ prove that there is a
  countable subset $S$ of $X$ such that every continuous function
  $f\colon X\to\mathbb{R}$ is determined by its values on $S$.

Proof: Define $S=\mathbb{Q}^n\cap X$. It is obvious that $S$ is countable and $\bar{S}=X$, since rationals are countable and dense in reals. The function $f$ is continuous on $X$, therefore $f(x)=\lim\limits_{x_k\to x}f(x_k)$ for any $x\in X$ and $x_k\in S$, i.e., $f$ is determined by its values on $S$.
Is my proof correct or am I missing something? I'm asking just because I came across another solution which seems to be unnecessarily complicated to me.
 A: Note that $\Bbb R^n$ has a countable base: all finite products of open intervals with rational endpoints, or all open ball around rational points with rational radii. Enumerate them as $\{B_n: n \in \Bbb N\}$, say.
Now for any (not just closed) subset $X$ of $\Bbb R^n$ pick $x_n \in B_n \cap X$ whenever  this intersection is non-empty, and this gives us a countable dense subset $D_X $ of $X$ (we cannot assume these points have rational coordinates, they're more likely to be all irrational; and closed subsets of the reals without any rational points exist in abundance, e.g.). And such a $D_X$ has the property that any continuous function on $X$ is determined by its values on $D_X$, in the sense that 
$$\forall f,g: X \to \Bbb R: (f\restriction_{D_X} = g\restriction_{D_X}) \implies f \equiv g \text{ on } X$$
We need that all subsets of $\Bbb R^n$ are separable and this is implied by having a countable base. (equivalent to it in all metric spaces, in fact.)
A: No, this is not quite correct yet. Think about what happens for $n=1$ and $X=[0,1] \cup \{\pi\}$. Even more striking, for $X=\{\pi\}$ the set $S=X\cap\Bbb Q$ is empty, while the actual claim is trivial in that case. The problem with your approach is that this construction does not guarantee that every point in $X$ is indeed the limit of a sequence in $S$.
