Let $X$ be a metric space. Let $E$ be a subset of $X$.
(1). any continuous function $f:E\longrightarrow \mathbb{R}$ can be extended to a continuous function $g: X\longrightarrow \mathbb{R}$ such that $g|_E=f$.
(2). $E$ is closed in $X$.
are (1), (2) equivalent?
Let $E$ be a subset of $\mathbb{R}^n$.
(3). any smooth function $f:E\longrightarrow \mathbb{R}$ can be extended to a smooth function $g: \mathbb{R}^n\longrightarrow \mathbb{R}$ such that $g|_E=f$.
(4). $E$ is closed in $\mathbb{R}^n$.
are (3), (4) equivalent?