You are on page 1of 4

Ummara Ahmed |1

Array Code with different functions

Question: What are the differences between one dimensional array and a multi-
dimensional array?

Array is a data structure used to represent similar type of data in a continuous manner.

In one dimensional array, the memory allocation is in the form of continuous manner and we
can access data using index directly.

In multi-dimensional array also the memory allocation is in the form of continuous manner
based on rows.

If user want to create a multi-dimensional array with 3 rows and 3 columns then

1. one dimensional array with 3 indices will be created.


2. For every index in the 1st step, the memory is divides to 3 columns. Most of
the people use matrix representation to represent multi-dimensional for easy
understanding.
Ummara Ahmed |2

1. Declaring var array = [“X”, “Y”]

2. Length of An Array (.length)


Ummara Ahmed |3

3. Adding value to an Array (.push)

4. Removing value from an Array (.pop)


Ummara Ahmed |4

5. Loop through an Array - loop to find a value within the array.

//left with three more functions of arrays

You might also like