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!
ย