-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
158 lines (67 loc) · 1.75 KB
/
script.js
File metadata and controls
158 lines (67 loc) · 1.75 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
//hàm reduce()
/*
const myArray = [0, 1, -1, 2, -2, 3, -3, 4];
let herArray = myArray.reduce((accumulator, sum) => accumulator + sum ,0)
console.log(herArray)
*/
//Object testing
/*
const myObj = {
name: "Minh",
age: 16,
gender: "Male",
getName: function() { return `${this.name} năm nay ${this.age} tuổi nhé mọi người !`},
trait: "fat",
}
console.log(myObj.getName())
*/
// Object Constructor
/*
let User = function(firstName, lastName, age) {
this.firstName = firstName;
this.lastName = lastName;
this.age = age;
this.info = function() {
return `Họ và tên: ${this.firstName} Đức ${this.lastName}
Tuổi: ${age} `;
}
}
User.prototype.middleName = "Đức";
User.prototype.getMiddleName = function() {
return this.middleName;
}
var author = new User("Nguyễn", "Minh", 16);
console.log(author)
*/
//for & array testing
/*
let myArray = ["A", "B", "C", "D", "E"];
myArray.push("F");
for (let i = 0; i < myArray.length; i++) {
console.log(myArray[i]);
}
myArray.push("G");
for (let i = 0; i < myArray.length; i++) {
console.log(myArray[i]);
}
console.log(myArray);
*/
// for (j of Object.values(myObj)) {
// console.log(j);
// }
/*
for (let i = 100; i >=0; i--) {
if (i%5==0) {
console.log(i);
} else if (i%10==0) {
continue;
}
}
*/
let myArray = [1, "1", "mot", true, [0, "khong"], {minh: 123}];
function test(param) {
return param.map(element => {
console.log("Hot food" + " " + element);
});
}
test(myArray);