For an object (or variable) named myText, use the following syntax:
var numOfWords = CountWords(myText)
var numOfWords = CountWords("Test string – could also be a variable")