<pre class="foo" id="bar" contenteditable></pre>NamedNodeMap: item() method / notebook
NamedNodeMap: item() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
const pre = document.querySelector("pre");
const attrMap = pre.attributes;
pre.textContent = `The attribute map contains:
0: ${attrMap.item(0).name}
1: ${attrMap[1].name}
2: ${attrMap.item(2).name}`;