Dom Met Node Haschildnodes
# XML DOM hasChildNodes() Method
## Definition and Usage
The `hasChildNodes()` method returns `true` if a node has child nodes, otherwise it returns `false`.
## Syntax
nodeObject.hasChildNodes()
## Example
The following code snippet uses [loadXMLDoc()](#) to load "[books.xml](#)" into `xmlDoc` and returns whether the first `` element has child nodes:
```javascript
xmlDoc=loadXMLDoc("books.xml");
x=xmlDoc.getElementsByTagName("book");
document.write(x.hasChildNodes());
Output:
true
[Try it yourself Β»](#)
YouTip