JavaScript DOM isEqualNode() method

 <!DOCTYPE html>

<html>

    <head>

        <title>Page Title</title>

    </head>

    <body>

        <ul id="list1">

            <li class="abc">Orange</li>

            <li>Banana</li>

            <li>Apple</li>

            <li>Grapes</li>

        </ul>

        <ul id="list2">

            <li>Guava</li>

            <li class="abc">Orange</li>

            <li>pineapple</li>

        </ul>

        <script>

            var target1 = document.getElementById("list1").firstElementChild;

var target2 = document.getElementById("list2").children[1];

var equal = target1.isEqualNode(target2);

console.log(equal);

        </script>

    </body>

</html>



OUTPUT




Comments