Open
Conversation
7-converter/app.js
Outdated
| @@ -0,0 +1,22 @@ | |||
| // Совершенно не понял как сделать это, пытался прогуглить, но там уже более сложные примеры и варианты решения подобной задачи. Направьте, пожалуйста, какое решение применить? | |||
|
|
|||
| function summ (amount, sourceCurrency, targetCurrencyUSD, targetCurrencyEUR ) { | |||
Collaborator
There was a problem hiding this comment.
- 3 - параметра (сумма, из какой валюты, в какую валюту)
- Далее внутри функции у тебя должны быть коэффициенты для перевода валюты из одной в другую
switch (initialCurrency) {
case 'RUB': switch (targetCurrency) {
case 'USD': return amount / 89.7619;
case 'EUR': return amount / 97.9126;
case 'GBP': return amount / 113.6027;
default: return null;
}
case 'USD': switch (targetCurrency) {
case 'RUB': return amount * 89.7619;
case 'EUR': return amount * 0.9168;
case 'GBP': return amount * 0.7901;
default: return null;
}
case 'EUR': switch (targetCurrency) {
case 'RUB': return amount * 97.9126;
case 'USD': return amount * 1.0908;
case 'GBP': return amount * 0.8619;
default: return null;
}
case 'GBP': switch (targetCurrency) {
case 'RUB': return amount * 113.6027;
case 'USD': return amount * 1.2656;
case 'EUR': return amount * 1.1602;
default: return null;
}
default:
return null;
}
Owner
Author
There was a problem hiding this comment.
Теперь понял, благодарю!
8-crypto/app.js
Outdated
| console.log(fullPassword); | ||
|
|
||
|
|
||
| // Как в массиве сделать перестановку символов местами без их удаления и вернуть потом обратно? |
Collaborator
There was a problem hiding this comment.
ну можешь циклом for бежать по массиву) метод сплайс мутирует твой массив исходный, из за этого у тебя баги
9-sort-loops/app.js
Outdated
| @@ -0,0 +1,35 @@ | |||
| const arr = [1, 40, -50, -20, -10, 5, 0, 100]; | |||
|
|
|||
| function sort(arrayOfSort) { | |||
Collaborator
There was a problem hiding this comment.
вообще не верно решил))) в чем смысл программирования? в автоматизации) а теперь представь что у тебя миллион элментов в массиве?)
https://proglib.io/p/bubble-sort - почитай про алгоритм сортировки)
Owner
Author
|
Закоммитил 11-date-array |
Owner
Author
|
Закоммитил 12-luna |
SergeyKrasnolobov
approved these changes
Nov 10, 2024
| .map(date => date.toLocaleDateString('ru-RU')) | ||
| .sort((a, b) => a - b); | ||
|
|
||
| console.log(validDates); No newline at end of file |
Collaborator
There was a problem hiding this comment.
Результат работы этой функции - мутация над исходными данными - ['02.10.2022', '12.11.2023']
В исходном массиве формат даты задан по другому))
SergeyKrasnolobov
approved these changes
Nov 10, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
7 - converter
8 - crypto
9 - sort-loops