Child node count in JavaScript?

JavascriptWeb DevelopmentObject Oriented Programming

Use children.length to get the count of child node.


 Live Demo

<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initialscale=1.0">
<link rel="stylesheet" href="//">
<script src=""></script>
<script src=""></script>
<link rel="stylesheet" href="">
List Of Subject Names are as follows:
<li id="subjectName">Python</li>
   var arrayValueOfSubject =
   console.log("The count of child node

To run the above program, just save the file name anyName.html(index.html) and right click on the file and select the option open with live server in VSCode Editor.


This will produce the following output −

Published on 14-Sep-2020 11:43:22