You haven’t supplied us with any code for your problem.
I assume you want to count the number of words in a string
You can use the ".length" property of arrays to find how big it is.
var myString = "How are you doing today?";
var words = myString.split(" ");