Array in Javascript | What is Array in Javascript
Array: it is a primary data structure of JavaScript that is used to store collection of elements using proper sequence. it provide better data arrangement for one dimensional and multidimensional structure.
Syntax:
let identifier = [item1,item2,item3,...]
console.log(item1[0])
Advantage:-
1) it contains multiple values under single variable that reduce code complexity.
2) array store element into proper sequence hance we can easily search and sort the data.
3) reduce extra memory space.
Disadvantage:
1) if list is large then array provide more time to search the element because it search by index.
2) array size is fixed means it can be increased or decreased.
Create First Program
1) Declare and traverse elements of Array:
WAP to merge two array in one array?
WAP to display only duplicate elements and it should be display once?
[1,2,2,2,3,4,5,1,7]
1,2
WAP to display unique element in array?
[1,2,2,2,3,4,5,1,7]
3 4 5 7
WAP to count most repeated element in array?
[1,2,2,2,3,4,5,1,7]
2
WAP to find first, second max element in array?
[1,2,2,2,3,4,5,1,7]
7,5
WAP to print prime element in array?
[1,2,2,2,3,4,5,1,7]
2 5 7
WAP to create character array and find frequency of each character?
['1','2','2','2','3','4','5','1','7']
1 1
2 3
3 1
4 1
5 1
7 1
POST Answer of Questions and ASK to Doubt