Javascript counter example