Skip to content

Commit 4ac5fd2

Browse files
authored
Merge pull request #4 from dansergey/master
Модуль 3
2 parents 4abd35f + 9c1bc96 commit 4ac5fd2

File tree

6 files changed

+30
-9
lines changed

6 files changed

+30
-9
lines changed

2-module/3-task/index.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
let calculator = {
22
read: function (a, b) {
3-
calculator.a = a;
4-
calculator.b = b;
3+
this.a = a;
4+
this.b = b;
55
},
66
sum: function() {
7-
return calculator.a + calculator.b;
7+
return this.a + this.b;
88
},
99
mul: function() {
10-
return calculator.a * calculator.b;
10+
return this.a * this.b;
1111
}
1212
};
1313

3-module/1-task/index.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
12
function namify(users) {
2-
// ваш код...
3+
return users.map(user => user.name);
4+
5+
/*const names = [];
6+
for (const {name} of users) {
7+
names.push(name);
8+
}
9+
return names;*/
310
}
11+
12+

3-module/2-task/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
function filterRange(arr, a, b) {
2-
// ваш код...
2+
return arr.filter(item => item >= a && item <= b);
33
}
4+
5+

3-module/3-task/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
function camelize(str) {
2-
// ваш код...
2+
return str.split('-').map((item, index) => index == 0 ? item : item[0].toUpperCase() + item.slice(1)).join('');
33
}
4+
5+

3-module/4-task/index.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
function showSalary(users, age) {
2-
// ваш код...
2+
return users.filter(user => user.age <= age).map(user => `${user.name}, ${user.balance}`).join('\n');
3+
34
}
5+
6+
7+
8+
9+

3-module/5-task/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
function getMinMax(str) {
2-
// ваш код...
2+
let a = str.split(" ").map(Number).filter(item => !isNaN(item)).sort((a, b) => a - b);
3+
const result = {min: a[0], max: parseInt(a.slice(-1), 10)};
4+
return result;
35
}

0 commit comments

Comments
 (0)