Let $f\colon [a,b] \to \mathbb R$ be continuous. Define $g\colon [a,b] \to \mathbb R$ by $g(x)=\max \{f(y); a\le y\le x\}$. Prove that $g$ is continuous on $(a,b)$.

I know $g(x)$ will continuous on $(a,b)$ but I do'nt know how to prove.. well. My ideais that While $f$ is non increasing, $g$ will be constant in that interval and when $f$ is increasing, $g$ is increasing too following $f$ and because constant function and $f$ are continuous, if we show that in critical point $g$ is also continuous, then the proof.will be.finished..?
I think that I am not used to proving with epsilon delta.. Anyway I want to know the proof with using epsilon delta or other