Dom Traversal for Fun and Profit

const grandparent = document.getElementById("grandparent-id")
const parent = Array.from(document.getElementsByClassName("parent"))
const children = parentOne.children
const childFour = document.querySelector("#child-four") const parent = childFour.parent
const childFour = document.querySelector("#child-four") const grandparent = childFour.closest(".grandparent")
const grandparent = document.querySelector(".grandparent") const childOne = grandparent.querySelector(".child")

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Calvin Torra

Calvin Torra

Frontend Developer fuelled by pizza, coffee and web3