A simple JavaScript format function.