Javascript Check if an Element Is a Descendant of Another
Learn how to Javascript Create & Use States Name Array
Published
Code Example
<script>
const isDecendent = (child, parent) =>parent.contains(child);
const parent = document.querySelector("#div1");
const child = document.querySelector("#div2");
console.log(isDecendent(parent, child));
</script>