I want to change the contents of a string in a function like
function appendSeparating(s, s2, separator) {
if (s != "")
s += separator;
s += s2;
}
I would like to change s on return, but since the string is a primitive, it is passed by value, so modifications do not affect the original.
What is the most efficient / clean way to handle this? (I try to keep the code concise)
source
share