Here is a question about two definitions. They are the following:

Definition 1. Let $\displaystyle k$ be a fixed algebraically closed field. If $\displaystyle X, Y$ are two affine varieties, a morphism $\displaystyle \phi : X \rightarrow Y$ is a continuous map such that for every open set $\displaystyle V \subseteq Y$, and for every regular function $\displaystyle f : V \rightarrow k$, the function $\displaystyle f \circ \phi : \phi^{-1}(V) \rightarrow k$ is regular.

Definition 2. A map $\displaystyle f : X \rightarrow Y$ between two affine varieties $\displaystyle X \subseteq \mathbb{A}^m$ and $\displaystyle Y \subseteq \mathbb{A}^n$ is called a morphism if there exists $\displaystyle n$ polynomials $\displaystyle f_1, \ldots, f_n \in k[x_1, \ldots, x_m]$ such that $\displaystyle f(x)=(f_1(x), \ldots, f_n(x))$ for all $\displaystyle x =(x_1, \ldots, x_m) \in X$.

These are two definitions from different textbooks: Hartshorne, Algebraic Geometry, and Mumford, Algebraic Geometry I. Are these definitions equivalent or a similar restatement of them equivalent? If so, how do you prove that they are equivalent? I believe that they are equivalent but I do not see how to prove this. Thanks for your help.