Html – Unexpected result is return by document.getElementsByTagName and javascript behaviour
HTML : <html> <body> <div id="a"> </div> </body> </html> Above is my simple html given and i wrote a function to add a children div in each div. function appendChildren() { var allDivs = document.getElementsByTagName("div"); console.log(allDivs) // [div#a, a: div#a]…