-
Notifications
You must be signed in to change notification settings - Fork 32
Алексей Вольхин #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
base: dev
Are you sure you want to change the base?
The head ref may contain hidden characters: "\u0410\u043B\u0435\u043A\u0441\u0435\u0439-\u0412\u043E\u043B\u044C\u0445\u0438\u043D"
Алексей Вольхин #21
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,23 @@ | |
* @param {*} array массив | ||
* @returns удвоенный массив | ||
*/ | ||
function calculateDoubleArray(array) { | ||
} | ||
|
||
function calculateDoubleArray(array) | ||
{ | ||
let doubledArray = []; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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]); | ||
} | ||
|
||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Доработать |
||
return doubledArray; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2 балла |
||
} | ||
module.exports.calculateDoubleArray = calculateDoubleArray; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Доработать |
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2 балла |
||
module.exports.factorial = factorial; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,13 @@ | |
* @return {number} Количество уникальных имён | ||
* */ | ||
function countUniqueName(nameArray) { | ||
let names = []; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Решение достаточное. |
||
names.push(highWord); | ||
} | ||
} | ||
return names.length; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2 балла |
||
|
||
module.exports.countUniqueName = countUniqueName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+2 балла