代码示例:(标识:jsck_document_createtextnode_1)
<!DOCTYPE html>
<html>
<body>

<h1>Document 对象</h1>

<h2>createTextNode() 方法</h2>

<p>创建文本节点:</p>

<script>
const textNode = document.createTextNode("Hello World");
document.body.appendChild(textNode);
</script>

</body>
</html>
运行结果: