<!doctype html>
<head id="my-document-head">
<title>Example: using document.head</title>
</head>Document: head property / notebook
Document: head property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
const theHead = document.head;
console.log(theHead.id); // "my-document-head";
console.log(theHead === document.querySelector("head")); // true