Why use data[0]?

Why does it work only with data[0] and not just data??

httpRequest.onreadystatechange = function(){
				if(this.readyState==4 && this.status==200){
					user_data = JSON.parse(this.responseText);
					document.getElementById("display").innerHTML = "Temp ="+user_data.data[0].temp+" C";					
				}
			}

But writing the below code doesn’t work

httpRequest.onreadystatechange = function(){
				if(this.readyState==4 && this.status==200){
					user_data = JSON.parse(this.responseText);
					document.getElementById("display").innerHTML = "Temp ="+user_data.data.temp+" C";					
				}
			}

After all data array has only one index, if it had more than one index it would be understandable to mention the index in square brackets e.g data[0] or data[1] or data[2] etc.
But it only has one index, so why do we need to write data[0] ??

Hi @rishav_201900071 ,

Arrays always require [ ] notations, even if they have just 1 element. You see, elements can be added/removed at runtime to/from the array as JavaScript is dynamically typed, there’s no fixed predictable size for the array. So using [0] notation makes sense.