Join array list using space in js code example
Example 1: javascript join list of string
// array.join(separator)
var myArray ['foo', 'bar', 'baz'];
myarray.join(':');
// foo:bar:baz
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>