$\newcommand{\stirling}[2]{\genfrac{\{}{\}}{0pt}{}{#1}{#2}}$Your comment is correct in that there are $4^5=1024$ functions from $A$ to $B$.
Letting $|A| =n, |B| = m$ this can be seen by the identity:
$$\sum_{k=0}^n \stirling{n}{k} m(m - 1) \dotsb (m - k + 1) = m^n$$
This describes all the ordered partitions of $A$ over $B$ where each partition is an assignment to the same item in $B$.
A less heady explanation (and perhaps easier to visualize) is the following:
We have a vector of length $n$. Each position in this vector can choose $m$ possible values. That is, the $i$th value in the vector represents what $f(a_i)$ maps to. How many $n$-length vectors over $m$ values can we have? Exactly $m^n$.