JavaScript Unicode 输入文本框

JavaScript Unicode Input Text Box

我正在尝试使用 JavaScript 将输入文本框的值设置为此表情符号 >>
但是它并没有像我期望的那样工作。
我已经尝试了几种不同的格式来表达 Unicode,但 none 有效。
我已经包含了我试过的片段。

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>

    <script>
      var myTextBox = document.createElement("input");
      document.body.appendChild( myTextBox );
      myTextBox.value = "&#129300";

      // None of below will work:
      // \u1F914
      // \xF0\x9F\xA4\x94
      // &#129300;
    </script>

    <p> &#129300; </p>

  </body>
</html>

知道如何正确执行此操作吗?

您需要将其转换为代理对:"\uD83E\uDD14"

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>

    <script>
      var myTextBox = document.createElement("input");
      document.body.appendChild( myTextBox );
      myTextBox.value = "\uD83E\uDD14";
    </script>

    <p> &#129300; </p>

  </body>
</html>