Skip to content

Алексей Вольхин #21

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

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open
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
7 changes: 5 additions & 2 deletions topic-1/task-1/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
* @returns
*/

function isTriangle(a, b, c) {
function isTriangle(a, b, c)
{
return ((a + b > c) && (a + c > b) && (b + c > a))
}

Copy link
Contributor

Choose a reason for hiding this comment

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

+2 балла

module.exports.isTriangle = isTriangle;
module.exports.isTriangle = isTriangle;

20 changes: 18 additions & 2 deletions topic-1/task-2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,23 @@
* @param {*} array массив
* @returns удвоенный массив
*/
function calculateDoubleArray(array) {
}

function calculateDoubleArray(array)
{
let doubledArray = [];
Copy link
Contributor

Choose a reason for hiding this comment

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

Используй const

for (let i = 0; i < array.length; i++)
{
if (array[i] === 0)
{
doubledArray.splice(i,0);
}
else
{
doubledArray.push(array[i]);
doubledArray.push(array[i]);
}

}
Copy link
Contributor

Choose a reason for hiding this comment

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

Доработать

return doubledArray;
Copy link
Contributor

Choose a reason for hiding this comment

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

2 балла

}
module.exports.calculateDoubleArray = calculateDoubleArray;
15 changes: 14 additions & 1 deletion topic-1/task-3/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@
*/

function factorial(n) {
if (n < 0){
throw new Error("Value must be more than zero");
}
else if (n === 0) {
return 1;
}
else {
let result = n;
while (n > 1) {
n--;
result *= n;
}
return result;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Доработать


Copy link
Contributor

Choose a reason for hiding this comment

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

2 балла

module.exports.factorial = factorial;
9 changes: 8 additions & 1 deletion topic-1/task-4/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
* @return {number} Количество уникальных имён
* */
function countUniqueName(nameArray) {
let names = [];
Copy link
Contributor

Choose a reason for hiding this comment

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

Используй const

for (let word of nameArray) {
let highWord = word.toUpperCase();
if (!names.includes(highWord)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Решение достаточное.
Совет на будущее. Set работает намного эффективнее в сравнивании и прочем. Если захочешь разобраться, можешь подойти, разберем вместе)

names.push(highWord);
}
}
return names.length;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

2 балла


module.exports.countUniqueName = countUniqueName;