0

The result of the following code is only ‍♂️ , where I want to find all the unique graphic represationations shown in the Firefox output that I copied to the var a originally. (Basically the code should show the original a string as output.)

How to do that?

<html>
<head>
<meta charset="UTF-8" />
<script>
var a = '‍♂️ ‍♂️ ‍♂️       ‍‍ ‍‍ ‍‍ ‍‍ ‍‍ ‍‍ ‍‍ ‍‍ ‍‍ ‍‍ ‍‍ ‍‍ ‍‍ ‍‍ ‍‍ ‍‍ ‍‍ ‍‍ ‍‍ ‍‍ ‍‍ ‍‍ ‍‍ ‍‍ ‍‍  ‍‍ ‍‍ ‍‍ ‍‍ ‍‍  ‍‍ ‍‍ ‍‍ ‍‍ ‍‍  ‍‍ ‍‍ ‍‍ ‍‍ ‍‍  ‍‍ ‍‍ ‍‍ ‍‍ ‍‍   ‍‍ ‍‍ ‍‍ ‍‍ ‍‍  ‍‍ ‍‍ ‍‍ ‍‍ ‍‍  ‍‍ ‍‍ ‍‍ ‍‍ ‍‍  ‍‍ ‍‍ ‍‍ ‍‍ ‍‍   ‍‍ ‍‍ ‍‍ ‍‍ ‍‍  ‍‍ ‍‍ ‍‍ ‍‍ ‍‍  ‍‍ ‍‍ ‍‍ ‍‍ ‍‍  ‍‍ ‍‍ ‍‍ ‍‍ ‍‍        ';
var b = [...new Set([...a])];
var c = b.join('');
function init() { document.getElementById('result').innerHTML = c; }
</script>
</head><body onload="init()">
<span id="result"></span>

</body>
</html>
John
  • 57
  • 8
  • Have a look at https://stackoverflow.com/questions/6885879/javascript-and-string-manipulation-w-utf-16-surrogate-pairs – Jonas Wilms Dec 25 '19 at 13:39
  • Yeah well, emojis are composed of multiple unicodepoints, so JS has to represent them as those. I'm really curious for a solution (cause I can't think of one), so if this has no answer in a few days I'd raise a bounty :) – Jonas Wilms Dec 26 '19 at 09:07

0 Answers0