Hi so assume I have a match()
output array where all elements are strings, and i want to replace some of the text inside those strings but using forEach()
instead of a regular for loop.
lets suppose the output array is
stringsArray = ["<div>some text here</div>","<div>Some other text here</div>"];
again the code above is the output of a match()
of some text. which prints correctly in the console.
let parsedArray = stringsArray.forEach(element => element.replace(/<div>|<\/div>/g,'\n'));
for some reason the code above doesn't work, console.log(parsedArray)
comes back undefined.
should i use a regular for loop instead, if so why?