const rects = document.getElementById("rects").getClientRects();
console.log(rects.length); // Number of rectangles in the DOMRectList
if (rects.length > 0) {
console.log(rects.item(0)); // Logs the first DOMRect object
}DOMRectList: item() method / notebook
DOMRectList: item() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.