join

array

Converts all elements in array into a string separated by separator.

Signature

join(array: any[], separator?: string): string

Parameters

NameTypeDescription
arrayany[]The array to convert
separator?stringThe element separatorDefault: ,

Returns

string - Returns the joined string

Examples

Custom separator

import { join } from 'dashlite'

const result = join(['a', 'b', 'c'], '~')
console.log(result)

Output:

'a~b~c'

Available since version 1.0.0