String Array

A string array contains only the string elements which means it has all the memory blocks filled with the string values that can be accessed using the indexing syntax.

Example: The below code explains the string array implementation.

Javascript




const strArr =
['w3wiki', 'JavaScript', 'TypeScript'];
console.log("String Array: ", strArr);
console.log("First element: ", strArr[0]);


Output

String Array:  [ 'w3wiki', 'JavaScript', 'TypeScript' ]
First element:  w3wiki

Types of Arrays in JavaScript

A JavaScript array is a collection of multiple values at different memory blocks but with the same name. The values stored in an array can be accessed by specifying the indexes inside the square brackets starting from 0 and going to the array length – 1([0]…[n-1]).

A JavaScript array can be classified into multiple types:

Table of Content

  • Numeric Array
  • String Array
  • Array of Arrays (2D Arrays)
  • Array of Objects
  • Mixed Arrays
  • Array with empty values

Similar Reads

Numeric Array

A numeric array is an array that contains only the numeric values as elements that are stored at different memory locations but in a consecutive manner....

String Array

...

Array of Arrays (2D Arrays)

A string array contains only the string elements which means it has all the memory blocks filled with the string values that can be accessed using the indexing syntax....

Array of Objects

...

Mixed Arrays

An array of arrays or the 2D array contains the multiple arrays as its elements that are stored at different memory locations. It can be used to create the nested arrays....

Array with empty values

...

Contact Us