- Homogeneous arrays
- Heterogeneous arrays
- Multidimensional arrays
- Jagged arrays
As the name may suggest a homogeneous array is an array that stores a single data type(string, int or Boolean values).
var array = ["Matthew", "Simon", "Luke"]; var array = [27, 24, 30]; var array = [true, false, true];
A heterogeneous array is the opposite to a homogeneous array. Meaning it can store mixed data types.
var array = ["Matthew", 27, true];
Also known as an array of arrays, multidimensional arrays allow you to store arrays within arrays, a kind of “array-ception”.
var array = [["Matthew", "27"], ["Simon", "24"], ["Luke", "30"]];
Jagged arrays are similar to multidimensional array with the exception being that a jagged array does not require a uniform set of data.
var array = [ ["Matthew", "27", "Developer"], ["Simon", "24"], ["Luke"] ];
as you can see, each array within the overall array is not equal, the first array has three items stored in it, while the second has two and the third has just one.