उदाहरण
children.length प्रॉपर्टी से चाइल्ड नोड्स की संख्या गिनें।
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<label> List Of Subject Names are as follows: </label>
<ul>
<li>Javascript</li>
<li>MySQL</li>
<li>MongoDB</li>
<li>Java</li>
<li id="subjectName">Python</li>
</ul>
<script>
var arrayValueOfSubject = document.getElementById('subjectName').parentNode;
console.log("The count of child node is=" + arrayValueOfSubject.children.length);
</script>
</body>
</html>
फ़ाइल सेव करें और Live Server से खोलें।
आउटपुट
कंसोल में पैरेंट UL के चाइल्ड LI एलिमेंट्स की संख्या दिखाई देगी।