JSFiddle - React, Tailwind, and code Playground

by Santosh Thakur

HTML

<div id="elem"></div>

JavaScript

var elem = document.getElementById('elem'),
  str = "recommend an early morning visit to the Colosseum to avoid the crowd... Haha 😜 Haha 😜 Haha 😜  πŸ™€ 😿 😾 ";

 
var emoji = str.match(/\ud83c[\udf00-\udfff]|\ud83d[\udc00-\ude4f]|\ud83d[\ude80-\udeff]/g);

var uniqueList = emoji.filter((item, i, ar) => ar.indexOf(item) === i);

uniqueList.forEach(function(em){
 var replace = em;
 var re = new RegExp(replace,"g");
 str  = str.replace(re, "<b>"+em+"</b>");
});


elem.innerHTML=str;