@yesstudio/yes-utils
    Preparing search index...

    Function join

    • Joins elements of an array into a single string with specified delimiters.

      Parameters

      • array: string[]

        The array of strings to join.

      • glue: string

        The string to use as a delimiter between most elements.

      • and: string = glue

        The string to use as a delimiter before the last element, defaults to the same as glue.

      Returns string

      Returns the joined string.

      join(['apple', 'banana', 'cherry'], ', ', ' and ')
      // => 'apple, banana and cherry'

      join(['apple', 'banana'], ', ')
      // => 'apple, banana'

      join(['apple'], ', ')
      // => 'apple'