What happens when reversing an emoji in Javascript?

What happens when reversing an emoji in Javascript?

ยท

1 min read

We usually talk about reversing a string in Javascript, but have you ever thought of reversing an emoji in javascript? It will be fun to find out the results. I'm going to reverse the emoji in a string. You will be amazed to see the Result.

Let's get started

We will use the following code snippet to reverse a string,

const reverse = (text) => [...text].reverse().join("")
console.log(reverse("code"))

Let's try with some country flag emojis,

const reverse = (text) => [...text].reverse().join("")

// India Flag
reverse("๐Ÿ‡ฎ๐Ÿ‡ณ") // "๐Ÿ‡ฎ๐Ÿ‡ณ" -> "๐Ÿ‡ณ๐Ÿ‡ฎ"

// USA Flag
reverse("๐Ÿ‡บ๐Ÿ‡ธ") // "๐Ÿ‡บ๐Ÿ‡ธ" -> "๐Ÿ‡ธ๐Ÿ‡บ"

// United Kingdom flag
reverse("๐Ÿ‡ฌ๐Ÿ‡ง") //  "๐Ÿ‡ฌ๐Ÿ‡ง" -> "๐Ÿ‡ง๐Ÿ‡ฌ"

// Ukraine Flag
reverse("๐Ÿ‡บ๐Ÿ‡ฆ") // "๐Ÿ‡บ๐Ÿ‡ฆ" -> "๐Ÿ‡ฆ๐Ÿ‡บ"

// Russia Flag
reverse("๐Ÿ‡ท๐Ÿ‡บ") // "๐Ÿ‡ท๐Ÿ‡บ" -> "๐Ÿ‡บ๐Ÿ‡ท"

You can explore different emojis or flag emojis

Note: Not all emojis can be reversed

Conclusion

I hope this article was helpful to you! Thank you for reading!

Letโ€™s connect

If you found my content helpful and would like to thank me, feel free to Buy me a coffee :)

Have a great day!

ย