Confused here , topic from DOM(2nd topic in Selecting elements) in Js.so someone please clarify me
The lesson shows[2nd topic from selecting elements in DOM- JavaScript] :- The getElementsByClassName() method returns a collection of all elements in the document with the specified class name. For example, if our HTML page contained three elements with class="demo", the following code would return all those elements as an array: var arr=document.getElementByClassName("demo"); //accessing the second element. arr[1].innerHTML="Hi!"; From the above description and example, how it is possible to code will return all those elements in the array. According to me it Actually returns only one element( I.e, second element arr[1]) from the array. but description shows :- /* For example, if our HTML page contained three elements with class="demo", the following code would return all those elements as an array: */ Comment in the code shows:-, //accessing the second element. So confused here,someone please clarify me.