April 6, 2020
javascript array

JAVASCRIPT ARRAY | Introduction to Array Objects In JavaScript

In this tutorial we will be discussing about JavaScript array which entails how to use the array object when coding in JavaScript. In our previous tutorial we looked at the JavaScript string objects and we explained all the methods and properties associated with the JavaScript string object. If you haven’t gone through this tutorial you can do so using the link below

Read previous tutorial on: JAVASCRIPT STRINGS | Introduction To Strings Objects in JavaScript


An array is a collection of more than one variable. Recall that variables are used to store data so therefore we can also say that an array can be used to store data in groups. The syntax for an array is shown below

var cars = [ "lambo", "benz", "toyota" ];

The content found in the curly brace associated with the array can be either strings or number characters and each of the items stored in the array can be accessed using ordinal numbers. illustration shown below

cars[0] = the first element lambo

cars[1] = the second element benz

cars[2] = the third element toyota


Below are the list of properties of an array object

1 length This is used to reflect the number of elements of an array
2 index This is used to specify the index of an element in the string
3 constructor This is used to return a reference to the function that was used to create the object
4 prototype This property allows properties and methods to be added to an object
5 input Only found in arrays created by expression matches


1 forEach() This is used to specify a function for elements present in the array
2 concat() This is used to join two arrays together and returns a new array as result
3 indexOf() This is used to return the index value of a specified element present in the array
4 sort() This is used to sort array elements
5 toString() This is use to return a string that represents the array elements
6 unshift() This is used to add elements to the front of an array and returns a new array after the addition
7 splice() This is use to either add or remove elements of an array
8 reduce() This is used to reduce the array to a single value
9 reduceRight() This is used to reduce the array to a single value from the right
10 join() This is used to join elements of an array into a string
11 lastindexof() This is used to specify the index of an array element
12 Filter() This is used to create a new array with all the elements that passed a test
13 some() This returns true if an element of the array meets the text function
14 toSource() This is used to return a string that represents the source of the array
15 pop() This returns an element that was removed from the end of an array
16 push() This returns a new array after adding elements to the end of an array
17 reverse() This is used to reverse the other of an array element
18 map() This returns a new array that is populated with the outcome of calling a function on every element in the calling array
19 shift() This returns an element which was initially the first element of an array
20 every() This is used to check if all elements of an array satisfies the test implemented by a function
21 sort() This is use for sorting the elements of an array


Leave a Reply

Your email address will not be published. Required fields are marked *