how to get the nth child of dom js
//method one
var c = document.getElementById("myDIV").childNodes;
c[1].style.backgroundColor = "yellow";//first child
c[2].style.backgroundColor = "red";//second child
c[-1].style.backgroundColor = "green";//last child
c[-2].style.backgroundColor = "blue";//secound last child
//method two
let nth-child = document.querySeletorAll('myDiv:nth-child(n)');//gives nth child