0
Can anyone explain these code?
<html> <body> <div id ="demo"> <p>some text</p> <p>some other text</p> </div> <script> var a = document.getElementById("demo"); var arr = a.childNodes; for( var i = 0; i < arr.length; i++){ arr[i].innerHTML = "New text"; } </script> </body> </html> Here why used arr? Is these an array?
1 ответ
0
In this instance "arr" is created as an array to hold all the child elements of the "demo" div.