how to remove newline from data received in node js with puppeteer

I need help with the below code. How do I remove all the newline n in the rawTxt output? The current output for rawTxt is rawTxt: ‘nnnnnnnnKangol Men, Women Washed Bucket Hatnnnnnnn’

I tried .replace(/n/g) and .replace([sS]) but no luck. Been searching around all day today but no luck 🙁

const puppeteer = require('puppeteer');

async function scrapeProduct(url) {
    const browser = await puppeteer.launch();
    const page = await browser.newPage();
    await page.goto(url);

    const [el] = await page.$x('//*[@id="landingImage"]');
    const src = await el.getProperty('src');
    const srcTxt = await src.jsonValue();

    const [el2] = await page.$x('//*[@id="productTitle"]'.replace(/n/g, ''));
    const txt = await el2.getProperty('textContent');
    const rawTxt = await txt.jsonValue();

    console.log({srcTxt, rawTxt});



// { srcTxt: '', rawTxt: 'nnnnnnnnKangol Men, Women Washed Bucket Hatnnnnnnn' }


You can try the folowing code:

const input = 'nnnnnnnnKangol Men, Women Washed Bucket Hatnnnnnnn';

console.log('initial input=', input);
console.log('new input =', input.replaceAll('n',''));