JSFiddle - React, Tailwind, and code Playground
JavaScript
var s = "Hello everyone on stackoverflow";
var y = "<html><head><head><body><div>Hello<span>everyone</span>on stackoverflow</div></body></html>";
//using regular expressions match HTML tags and replace them with empty string. Make sure to trim the output so that the extra whitespaces at either end are removed.
var z = y.replace(/(<([^>]+)>)/ig, ' ').trim();
//compare if the stripped string matches the other string.
if(z == s) {
s = y;
}
alert(s);