JS Utils Kit - v0.5.1
    Preparing search index...

    Function countWords

    • Counts the number of words in a string.

      Parameters

      • str: string

        The input string

      Returns number

      Number of words in the string.

      countWords("js utils kit");         // 3
      countWords(" js utils kit"); // 3
      countWords(""); // 0