I have read about the difference between both: Difference between dot and bracket notation
However when I try to put together a simple HTML example using default JavaScript .length to refer to them:
<ul id="allList">
  <li>a</li>
  <li>b</li>
  <li>c</li>
  <li>d</li>
  <li>e</li>
  <li>f</li>
</ul>
console.log(document.getElementById("allList").getElementsByTagName("li").length);
//6
console.log(document.getElementById("allList").getElementsByTagName("li")[length]); 
//<li>a</li> 
Using dot notation is giving me 6 because it registers total of 6 arrays from the HTML but when comes to bracket, why is it giving me the first html list instead?
Working example here: sample code
Updates: Ok I just found out that I have missed out the quotes. It should be ["length"] instead of [length]. Question solved.