JavaScript word counter.