Simple and easy
const getTextFromHTML = (htmlString) => { const div = document.createElement('div'); // Pass 'div' as a string div.innerHTML = htmlString; return div.innerText; }