-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray.html
More file actions
28 lines (27 loc) · 721 Bytes
/
array.html
File metadata and controls
28 lines (27 loc) · 721 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<script>
//simple array
var myarray=["kush",32,152.65]
//Nested array
var nested_array=[[12,35,57,96],[125.36,124.3]]
//access simple array
console.log(myarray[2])
//modify array
myarray[1]=18;
console.log(myarray[1])
//access nested array
console.log(nested_array[1][0])
//push
var array = ['kush','j','juthani']
array.push(['happy','joy'])
console.log(array);
//pop
var array1=[1,2,3];
array1.pop();
console.log(array1);
//shift is use to remove first elements on the array
array1.shift();
console.log(array1);
//unshift is use to add new element in first positshion
array1.unshift(5);
console.log(array1);
</script>