Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Решила задачи 1,2,3 из 2ого модуля и 1ую задачу из 3его модуля #4

Merged
merged 2 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion 2-module/1-task/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
let salaries = {
John: 1000,
Ann: 1600,
Pete: 1300,
month: 'December',
currency: 'USD',
isPayed: false,
a:NaN,
b:Infinity,
};

function sumSalary(salaries) {
// ваш код...
}
let arr = Object.values(salaries);
let sum = 0;

for(let elem of arr){
if(Number.isNaN(elem) || !Number.isFinite(elem) || typeof(elem) !== 'number'){
continue;
}else{
sum += elem;
}
}

return sum;
}
10 changes: 9 additions & 1 deletion 2-module/2-task/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
function isEmpty(obj) {
// ваш код...
}
let arr = Object.keys(obj);

if(arr.length > 0){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно так:
return arr.length === 0;

return false;
}else{
return true;
}

}
13 changes: 13 additions & 0 deletions 2-module/3-task/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@



let calculator = {
// ваш код
read(a, b){
this.a = a;
this.b = b;
},
sum(){
return this.a + this.b;
},
mul(){
return this.a * this.b;
},
};

// НЕ УДАЛЯТЬ СТРОКУ, НУЖНА ДЛЯ ПРОВЕРКИ
Expand Down
5 changes: 3 additions & 2 deletions 3-module/1-task/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
function namify(users) {
// ваш код...
}
users = users.map(user => user.name);
return users;
}
Loading