First implementation of a wordCounter written in JS