The work function is the minimum amount of energy needed for an electron to escape an atom. If you give an electron energy equal to the work function, it will escape the atom. It loses kinetic energy as it moves away from the atom and only reaches 0 kinetic energy at infinity. However, in real physics, we never have exactness. You can't really give exactly 2J of energy to anything. It's always something like 2.001J or so on.