@eroyeroy/utils - v0.1.0
    Preparing search index...

    Function countWords

    • Counts the number of whitespace-separated words in a string.

      Parameters

      • str: string

        The input string.

      Returns number

      countWords("hello world") // => 2
      countWords("") // => 0
      countWords(" ") // => 0