I have an array with strings if the string is foo I wish to replace it with bar.
I could do a for-loop:
for (var i = carpeDiem.length - 1; i >= 0; i--) {
if(carpeDiem[i] === '\n'){
carpeDiem[i] = '<br \>'
}
};
But is there a nicer way to do it. I only need to support modern browsers.
string.replace()?.forEach()or, if you don't want to modifycarpeDiem,.map()