Array is collection of elements.The element can be of same datatype or it can be different.we generally use const as variable to declare a array.we generally use [] brackets to declare and array. Two methods by which we declare an array.
const array=[1,2,3,4];
const array=new numbers{};
The elements inside an array can be accessed using index number.The index number starts from 0 and goes on.
const array=[1,2,3,4];
Here,array[1]=2;
Top comments (0)