When creating a CSV file, how to remove comma character from a text and insert space instead of comma

text = "Hello,world"
newText = '';
if (text.includes(',')) {

for (let j = 0; j < text.length; j++) {
         if (text[j] !== ',') {
                 newText += text[j];
         }
        else {
                newText += ' ';
         }
    }
}

Leave a comment

Your email address will not be published. Required fields are marked *