An implementation of word frequency counter problem in o(n) coded in javascript