join string to array js code example
Example 1: join javascript array
const cities = ['London', 'Paris', 'Tokyo'];
const joinedCities = cities.join('-');
console.log(joinedCities); // London-Paris-Tokyo
Example 2: join array javascript
<html>
<select multiple class="select-colors">
<option>blue</option>
<option>green</option>
</select>
</html>
<script>
var myColorSelect = $(".select-colors").val().join();
console.log(myColorSelect);
</script>