Join Array with Custom Separator and last Separator
npm i --save array-join-custom-separator
To use it, just import it into your application
import { ArrayJoinWithCustomSeparator } from 'array-join-custom-separator'; // import
const input = ['apple', 'banana', 'orange'];
ArrayJoinWithCustomSeparator(input);
}
To set a custom separator:
import { ArrayJoinWithCustomSeparator } from 'array-join-custom-separator'; // import
const input = ['apple', 'banana', 'orange'];
ArrayJoinWithCustomSeparator(input, " - ");
}
To set a custom separator and last separator:
import { ArrayJoinWithCustomSeparator } from 'array-join-custom-separator'; // import
const input = ['apple', 'banana', 'orange'];
ArrayJoinWithCustomSeparator(input, " - ", " and ");
}