JS4 ClassNotes
JS4 ClassNotes
Collections of items
Create Array
66 ];
arr[0], arr[1],
arr[2] ....
0 1 2 3 4
Looping over an Array
Print all elements of an
array
Let‘s Practice
Qs. For a given array with marks of students -> [85, 97, 44,
37, 76, 60] Find the average marks of the entire class.
Let‘s Practice
Qs. For a given array with prices of 5 items -> [250, 645, 300, 900, 50]
All items have an offer of 10% OFF on them. Change the array to store
final price after applying offer.
Arrays in JS
Array Methods
Push( ) : add to
end
Unshift( ) : add to
start