[Solved] An elegant way to surround a string in Javascript [closed]


This is much easier with ES6 template literals:

div.innerHTML = rawstr.split("\n\n").map(str => `<p>${str}</p>`)).join("");
newstr = oldstr.split(/\s+“|”\s+/g).map(str => `"${str}"`)).join(" ");
`${p[0]} (${p[1]}) ${p[2]}`

3

solved An elegant way to surround a string in Javascript [closed]