# Node: hasChildNodes() method



The **`hasChildNodes()`** method of the [Node](https://developer.mozilla.org/en-US/docs/Web/API/Node) interface
returns a boolean value indicating
whether the given [Node](https://developer.mozilla.org/en-US/docs/Web/API/Node) has [child nodes](https://developer.mozilla.org/en-US/docs/Web/API/Node/childNodes) or not.

## Syntax

```js-nolint
hasChildNodes()
```

### Parameters

None.

### Return value

A boolean value that is `true` if the node has child nodes, and
`false` otherwise.

## Example

```js
let foo = document.getElementById("foo");

if (foo.hasChildNodes()) {
  // Do something with 'foo.childNodes'
}
```

## Specifications

## Browser compatibility

## See also

- [Node.childNodes](https://developer.mozilla.org/en-US/docs/Web/API/Node/childNodes)
