Skip to content

Node.empty method

Node › empty

Official

Empties the node.

Signature:

empty(): void

Returns: void

Example:

const parent = createEl('p');
parent.createEl('strong');
console.log(parent.childNodes.length); // 1
parent.empty();
console.log(parent.childNodes.length); // 0