here I have some local function which should convert some HTML tags (keys) which contains some values into array. Every ended tag with some product have 2x '\n' which is included into array.
How can I remove breaking line from aray?
function cleanCatalog(s){
const separateValues = /<\/?[^>]+(>|$)/g;
let newLocal = s.replace(separateValues, " ");
let cleanText = newLocal;
let catalogArray = [cleanText.split(" ")];
return catalogArray;
}
output:
"["drill", "99", "5", "↵↵", "hammer", "10", "50", "↵↵", ...]"
.trim())