Merge
Merges array(s) of strings into a single string using a specified separator.
Parameters
Section titled “Parameters”sep:string|boolean- The separator to use between merged strings.- Provide a string to use as a separator between strings.
- Provide
falseor an empty string ('') for no separator. - Provide
truefor a space (' ') as the separator.
strings:string[]- The array of strings to merge.
Returns: string
Section titled “Returns: string”- The merged string.
function merge( separator: boolean | string, strings: string[] | string[][]): stringmerge('-', 'Apple', 'Orange', 'Banana') // 'Apple-Orange-Banana'
merge(true, ['Banana', 'Orange', 'Apple', 'Mango']) // 'Banana Orange Apple Mango'
merge(false, ['1', '2', '3'], ['4', '5', '6']) // '123456'