- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArray.js
More file actions
Latest commit
22 lines (19 loc) · 575 Bytes
/
Copy pathArray.js
File metadata and controls
22 lines (19 loc) · 575 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
letfruits=[];
console.log(fruits);
fruits=["Apple","Mango"]
console.log(fruits);
console.log(fruits[0]);
fruits.forEach(fruit=>{
console.log(fruit);
});
deletefruits[0]
console.log(fruits);
console.log(fruits[0]);
// In JS, array works like a list in python
// It can contain values of multiple types
// It can also contain array within array
letarr=["one",2,"three",4.0,[5,6,"seven"]]
console.log(arr);
console.log(arr[3]);
console.log(arr[4]);// Prints the array [5,6,"seven"]
console.log(arr[4][1]);// Prints second element of array within array