simple JavaScript f(x) and callback