Context:
So I am given the problem, "Show that $f:\mathbb R\to\mathbb R$ is neither 1-1 nor onto when $f$ is defined as $f(x) = x^2+ax+b$." I can do this easily enough using some tricks from basic calculus and whatnot, but it got me thinking that this neither 1-1 nor onto was something that should be true for quite a lot more functions.
Question
Now my idea is that for any function continuous $f:\mathbb R\to\mathbb R$ for which $$\lim_{x\to-\infty}f(x) = \lim_{x\to\infty}f(x)$$ then $f$ should be neither 1-1 nor onto.
This seems straightforward enough, but I am not sure how to go about proving such a thing. I'm pretty certain that I can show that it isn't 1-1 with some fancy use of the intermediate value theorem, but I'm fairly stumped on surjectivity, in fact I'm wondering if the function could do something odd where it keeps bouncing up and down in some weird way if it's able to cover all values in $\mathbb R$ in a finite space.
Note:
$\lim_{x\to-\infty}f(x) = \lim_{x\to\infty}f(x)$ is intended to imply that both these limits exist, or are $\pm\infty$
Assume without loss of generality that $L:=\lim_{x\rightarrow\infty}f(x)=\lim_{x\rightarrow-\infty}f(x)>0$, then for large $M$, we have if $|x|>M$, then $f(x)>L/2$. Then on $[-M,M]$, $f$ attains minimum $m$, say, $f(x_{0})=m$, then $f(x)>\min\{L/2,m\}$. Pick an $\alpha<\min\{L/2,m\}$, then there is no $x$ such that $f(x)=\alpha$.