-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path26.js
More file actions
38 lines (22 loc) · 901 Bytes
/
Copy path26.js
File metadata and controls
38 lines (22 loc) · 901 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
29
30
31
32
33
34
35
36
37
// Arrays: it is a collection of elements or items.
// array starts from 0th index
let fruits = ["apple", "mango", "banana", "orange"]
// index 0 1 2 3
// console.log(fruits);
let myArray = ["hello", 25, true, false, null, undefined, "yoo", 5049, {name: "rahman", rollNo: 49}, [12,32,45]];
// reading values in arrays:
// console.log(myArray[0], myArray[1], myArray[2], myArray[3]);
// console.log(myArray[4], myArray[5], myArray[6]);
// console.log(myArray[8]);
// console.log(myArray[9][2]);
// updating values in arrays
// myArray[1] = 30;
// myArray[4] = -"12";
// console.log(myArray);
delete myArray[3], delete myArray[4], delete myArray[5], delete myArray[6];
console.log(myArray);
// myArray[3] = "3rd index value";
// myArray[4] = "4th index value";
// myArray[5] = "5th index value";
// myArray[6] = "6th index value";
// console.log(myArray);