wordCount and makeChange functions in js