-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
90 lines (77 loc) · 1.47 KB
/
script.js
File metadata and controls
90 lines (77 loc) · 1.47 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// let, var
const nama = "doltons";
const umurDariNama = 20; // number
const boxBuah = ["mangga", "anggur", "apel", "jeruk", "pisang"]; // array
const listMovie = ["Marvel", "Minion"];
const marvelMovie = {
name: "Marvel",
};
// hitungan biasa - 1
const listSepuh = [
"Yusuf",
"Dika",
"Afif",
"Ilham",
"Ahmad",
[
[20, 29],
[21, 30],
],
[
{
nama: "Ilham",
umur: 20,
isMarried: false,
favFood: "bakso",
listFavMovie: [],
},
{
nama: "Yusuf",
umur: 20,
isMarried: false,
favFood: "bakso",
listFavMovie: [],
},
],
["Apel", "Mangga"],
];
console.log(listSepuh[6][1].nama); // Yusuf
const sepuhIlham = {
nama: "Ilham",
umur: 20,
isMarried: false,
favFood: "bakso",
listFavMovie: [],
};
// console.log(listSepuh[4]);
// console.log(sepuhIlham.favFood);
// init, condition, action
// for (let i = 0; i < 4; i++) {
// console.log(boxBuah[i]);
// }
// for in
// for (const buah of boxBuah) {
// console.log(buah);
// }
// for of
// for (const item in sepuh) {
// console.log(sepuh[item]);
// }
// // loop 1
// const item = "nama";
// sepuh[item];
// // loop 2
// const item = "umur";
// sepuh[item];
// console.log(sepuh.nama);
// console.log(sepuh.umur);
// console.log(sepuh.isMarried);
// console.log(sepuh.favFood);
// console.log(boxBuah[0]);
// console.log(boxBuah[1]);
// console.log(boxBuah[2]);
// console.log(boxBuah[3]);
// loop
// for loop
// while loop
// for in / for of