There are four types of array in javascript:

  • Homogeneous arrays
  • Heterogeneous arrays
  • Multidimensional arrays
  • Jagged arrays

Homogeneous 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 = ["Yamini", "Aman", "Yuvraj"];
var array = [21, 25, 27];
var array = [true, false, true];

Heterogeneous Arrays

A heterogeneous array is the opposite to a homogeneous array. Meaning it can store mixed data types.

var array = ["Yamini", 21, true];

Multidimensional Arrays

Also known as an array of arrays, multidimensional arrays allow you to store arrays within arrays, a kind of “array-ception”.

var array = [["Yamini", "21"], ["Aman", "25"], ["Yuvraj", "27"]];

Jagged Arrays

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 = [
    ["Yamini", "21", "Developer"],
    ["Aman", "25"],