javascript/word-count: First working solution