JavaScript - Object Node - The childElementCount property

In this tutorial of the childElementCount property, we will see how to use it.
It is really easy.
This method returns the number of elements of a node.

Example:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>

<div id="theDiv">
    <ul id="myUl">
        <li id="li0">Hello</li>
        <li id="li1">Welcome</li>
        <li id="li2">On</li>
        <li id="li2">BadproG.com</li>
    </ul>
</div>

<script type="text/javascript">

var myElement;
myElement = document.getElementById('theDiv');

document.write('myElement.childElementCount[1] = ' + myElement.childNodes[1].childElementCount);

</script>

</body>
</html>

The result is 4, of course. smiley