JSFiddle - React, Tailwind, and code Playground
JavaScript
var f = "Hello everyone on stackoverflow";
var o = "Hello";
var e = "everyone on";
var s = "stackoverflow";
if (f.indexOf(e) >= 0) {
var h = f.replace(e,"<strong>"+e+"</strong>");
}else{
var h = f;
}
if (h.indexOf(s) >= 0){
var h = h.replace(s,"<em>"+s+"</em>");
}
if (h.indexOf(o) >= 0){
var h = h.replace(o,"<u>"+o+"</u>");
}
$('body').append('<div>'+h+'</div>');