Javascript program playing with numbers