HTML Editor
<!DOCTYPE html> <html lang="en-US"> <body> <p>Open your console (Press F12) and Click on the button</p> <button onclick="myFunction()">Click Me</button> <script> var y = document.createElement("p"); function myFunction(){ y.appendChild(document.createTextNode("Part 1 ")); y.appendChild(document.createTextNode("Part 2 ")); document.body.appendChild(y); console.log("Before Normalize"); console.log(y.childNodes.length); y.normalize(); console.log("After Normalize"); console.log(y.childNodes.length); } </script> </body> </html>
OUTPUT
×

Save as Private