Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<h1>The Element Object</h1>
<h2>The lastElementChild Property</h2>
<div id="myDIV">
  <p>A P element - First child in "myDIV"</p>
  <span>A Span element - Last child in in "myDIV"</span>
</div>
<p>The tag name of "myDIV"s last child element is:</p>
<p id="demo"></p>
<script>
const element = document.getElementById("myDIV");
document.getElementById("demo").innerHTML = element.lastElementChild.tagName; 
</script>
</body>
</html>