This is an example HTML file:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8>
<title>emoji</title>
</head>
<body>
\ud83d\ude00
<script>
var string = '\ud83d\ude00';
document.write(string);
console.log(string);
</script>
</body>
</html>
The unicode character '\ud83d\ude00' within the body tag doesn't display as an emoji but as a string. However, when using document.write() and console.log(), it appears as an emoji despite the UTF-8 charset in the document. Why does this happen?