Try
stringOne
.filter(function(el) {
return el !== "";
})
.join(" - ");
The filter gets rid of all elements that are empty, join should be straightforward.
1
solved Logically concatenating strings separated by hyphens
Try
stringOne
.filter(function(el) {
return el !== "";
})
.join(" - ");
The filter gets rid of all elements that are empty, join should be straightforward.
1
solved Logically concatenating strings separated by hyphens