<ul id="list">
<li>First (1)</li>
<li>Second (2)</li>
<li>Third (3)</li>
</ul>Element: lastElementChild property / notebook
Element: lastElementChild property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
const list = document.getElementById("list");
console.log(list.lastElementChild.textContent);
// logs "Third (3)"