-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArray.js
More file actions
61 lines (41 loc) · 1.52 KB
/
Array.js
File metadata and controls
61 lines (41 loc) · 1.52 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// <<-------------|push , pop and , slice of an Array|------------>>
// const book = new Array("Math" , "English" , "hindi" , "Gujrati");
// book.push("akib");
// book.unshift("akib");
// book.pop();
// book.shift();
// book.slice(1,1);
// let position = book.indexOf(`English`);
// console.log(Array.isArray(book));
// <<-------------|split and join of an Array|------------>>
// let text = `This is random text here.`;
// let wordText = text.split(' ');
// let wordText = text.join(`-`);
// console.log(wordText);
// <<-------------|Concat of an Array|------------>>
// const name1 = new Array(`Akib` , `Aman`);
// const name2 = new Array(`Raza` , `Muzzamil`);
// let friends = name1.concat(name2);
// console.log(friends);
// <<-------------|Multidimensional Array|------------>>
// let bookWithPages = [
// [`Maths`, [`300` , `400`]], array in array
// [`English`, `100`],
// [`Science`, `400`],
// [`Hindi`, `150`],
// ];
// let fetch = bookWithPages[1][0];
// let fetch = bookWithPages[1];
// let fetch = bookWithPages[1][1];
// let fetch = bookWithPages[0][1][1];
// console.log(fetch);
// <<-------------|Array with loops|------------>>
// const book = new Array("Math" , "English" , "hindi" , "Gujrati");
// for (let index = 0; index < book.length; index++) {
// console.log(`Elements ${index} is ${book[index]} \n`);
// }
// <<-------------|Array with foreach|------------>>
// const book = new Array("Math" , "English" , "hindi" , "Gujrati");
// book.forEach(myFun => {
// console.log(myFun);
// });