I'm finding that I can't get emojis (aka "🦁") to render if I use .textContent = some string that includes emoji. BUT... if I do .innerHTML = "<p>same string that includes emoji</p> it works and displays properly.
Yes I have meta charset=UTF-8 set
Am I doing something wrong?
An example of what I'm talking about in this simple scrim: https://scrimba.com/scrim/cnDvbvcd
#Emoji won't render as textContent
4 messages · Page 1 of 1 (latest)
I think maybe because innerHTML parse value as HTML, but textContent doesn't
so you emoji code get parse into more human readable form in innerHTML
Hmm.. well...that's certainly a reasonable idea.
There are a lot of places in these 'casts where we are asked to use emojis as part of our text so if that's true that it will only work as part of innerHTML.. that would be a very useful tip/explanation to include in one of the lessons 🙂
I have discovered the String.fromCodePoint() but that's kind of obscure... but it does work! Just not exactly sure when it's needed.