So I have my code like this:
for (var i = 0; i < str.length; i++) {
str = str.replace("|", "Math.abs(");
str = str.replace("|", ")");
}
Is there anyway to get the same effect using a regex?
Or at least a regex with a function?:
str = str.replace(/?/g, function() {?});