Javascript treats arrays as an object, that is: arrays are a special type of object in Javascript
But the difference is that objects in JavaScript use names to access elements
1: var PM = {firstName:"Narendra", lastName:"Modi", age:70}; 2: PM.firstName returns Narendra.
But javascript arrays number the indices.
1: var fruits = ["Banana", "Orange", "Apple", "Mango"]; 2: fruits[2] returns Apple.
using collections, we can resemble the properties of a Javascript array in JAVA. That is, using List in java, you can store various data types in an array, for example: arraylist.
source share