-
Notifications
You must be signed in to change notification settings - Fork 0
DZ #2
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: develop
Are you sure you want to change the base?
DZ #2
Changes from 1 commit
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 |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| // Совершенно не понял как сделать это, пытался прогуглить, но там уже более сложные примеры и варианты решения подобной задачи. Направьте, пожалуйста, какое решение применить? | ||
|
|
||
| function summ (amount, sourceCurrency, targetCurrencyUSD, targetCurrencyEUR ) { | ||
| let USD = 90; | ||
| let RUB = 1; | ||
| let EUR = 96; | ||
| let targetUSD = USD > RUB; | ||
| let targetEUR = EUR > RUB; | ||
|
|
||
| switch(true) { | ||
| case targetUSD: | ||
| return (amount / USD) + targetCurrencyUSD; | ||
|
|
||
| case targetEUR: | ||
| return (amount / EUR) + targetCurrencyEUR; | ||
|
|
||
| default: | ||
| return null || 0; | ||
| } | ||
| }; | ||
|
|
||
| console.log(summ(1000, ` руб.`, `$`, `€`)); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <title>Document</title> | ||
| <script src="./app.js"></script> | ||
| </head> | ||
| <body> | ||
|
|
||
| </body> | ||
| </html> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| const password = ['s','s','a','p','d','o','r','w']; | ||
| const fullPassword = password.join(''); | ||
| console.log(fullPassword); | ||
|
|
||
|
|
||
| // Как в массиве сделать перестановку символов местами без их удаления и вернуть потом обратно? | ||
|
||
| function passEncryptor() { | ||
| password [2] = password.splice(0, 1, password[3])[0]; | ||
| console.log(password); | ||
|
|
||
| }; | ||
| passEncryptor(); | ||
|
|
||
| function passCheck () { | ||
| console.log(fullPassword.includes('ssapdorw'|| 'password')); | ||
| }; | ||
| passCheck(); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <title>Document</title> | ||
| <script src="./app.js"></script> | ||
| </head> | ||
| <body> | ||
|
|
||
| </body> | ||
| </html> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| const arr = [1, 40, -50, -20, -10, 5, 0, 100]; | ||
|
|
||
| function sort(arrayOfSort) { | ||
|
||
| for (const element of arrayOfSort) { | ||
| switch (true) { | ||
| case arr[0] > arr [1]: | ||
| arr1 = arr[1]; | ||
| arr[1] = arr[0]; | ||
| arr[0] = arr1; | ||
| case arr[1] > arr [2]: | ||
| arr2 = arr[2]; | ||
| arr[2] = arr[1]; | ||
| arr[1] = arr2; | ||
| case arr[2] > arr [3]: | ||
| arr3 = arr[3]; | ||
| arr[3] = arr[2]; | ||
| arr[2] = arr3; | ||
| case arr[3] > arr [4]: | ||
| arr4 = arr[4]; | ||
| arr[4] = arr[3]; | ||
| arr[3] = arr4; | ||
| case arr[4] > arr [5]: | ||
| arr5 = arr[5]; | ||
| arr[5] = arr[4]; | ||
| arr[4] = arr5; | ||
| case arr[5] > arr [6]: | ||
| arr6 = arr[6]; | ||
| arr[6] = arr[5]; | ||
| arr[5] = arr6; | ||
| }; | ||
| }; | ||
| return arr; | ||
| }; | ||
|
|
||
| console.log(sort(arr)) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <title>Document</title> | ||
| <script src="./app.js"></script> | ||
| </head> | ||
| <body> | ||
|
|
||
| </body> | ||
| </html> |
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.
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.
Теперь понял, благодарю!