js nth child code example
Example 1: javascript get element nth child
var second-child = document.querySeletorAll('[your element name]:nth-child(2)');
Example 2: how to get the nth child of dom js
var c = document.getElementById("myDIV").childNodes;
c[1].style.backgroundColor = "yellow";
c[2].style.backgroundColor = "red";
c[-1].style.backgroundColor = "green";
c[-2].style.backgroundColor = "blue";
Example 3: css nth-child
li:nth-child(1) { }
li:nth-child(odd) { }
li:nth-child(even) { }
li:nth-child(3n) { }
li:nth-child(3n+1) { }