For an object (or variable) named myText, use the following syntax:
var numOfLines = CountLines(myText)
var numOfLines = CountLines("Line1\nLine2\nLine3")