Edit This Code:
<!DOCTYPE html>
<html>
<body>

<p>Click the button to check if the ul element with id="myList" is the same as the document's first ul element. If so, add a color to its first child.</p>

<button onclick="myFunction()">Try it</button>

<ul id="myList"><li>Coffee</li><li>Tea</li></ul>

<script>
function myFunction() {
    var item1 = document.getElementById("myList");
    var item2 = document.getElementsByTagName("UL")[0];
    
    if (item1 === item2) {
        alert("THEY ARE THE SAME!!");
    } else {
        alert("They are not the same.");
    }
}
</script>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy