Does anyone know a simple way of counting the occurrences of a word in a Javascript String, without a predefined list of words that will be available? Ideally I would like it to output into an associative array (Word, Count).
For example an input along the lines of "Hello how are you Hello" would output something along the lines of:- "Hello": 2 "how": 1 "are": 1 "you": 1
Any help is greatly appreciated.
Thanks,