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

<h1>Document 对象</h1>

<h2>doctype 属性</h2>

<p>document.doctype.name 是:</p>

<p id="demo"></p>

<script>
const doctypeObj = document.doctype;
document.getElementById("demo").innerHTML = doctypeObj.name;
</script>

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