Tell me how to proceed with the repetition of the code from the beginning (do while), after the Oak pressurized, and the CODENA exit.
-
let askWhatValute = prompt("Введи название валюты", "uah, eur, usd, rub, zl"); let sum = +prompt("Введи сумму"); let inWhichValute = prompt( "В какую валюту конвертировать", "uah, eur, usd, rub, zl" ); let continueAgain; do { switch (askWhatValute) { case "uah": if (inWhichValute === "usd") { alert((result = sum * 0.038)); } else if (inWhichValute === "eur") { alert((result = sum * 0.032)); } else if (inWhichValute === "rub") { alert((result = sum * 2.72)); } else if (inWhichValute === "zl") { alert((result = sum * 0.15)); } break; case "usd": if (inWhichValute === "uah") { alert((result = sum * 25)); } else if (inWhichValute === "eur") { alert((result = sum * 0.86)); } else if (inWhichValute === "rub") { alert((result = sum * 70)); } else if (inWhichValute === "zl") { alert((result = sum * 4)); } break; default: alert("Проверь правильность написания"); break; } } while ((continueAgain = prompt("Хочешь повторить?")));
-
It?
let continueAgain;
do {
let askWhatValute = prompt("Введи название валюты", "uah, eur, usd, rub, zl");
let sum = +prompt("Введи сумму");
let inWhichValute = prompt(
"В какую валюту конвертировать",
"uah, eur, usd, rub, zl"
);switch (askWhatValute) {
case "uah":
if (inWhichValute === "usd") {
alert((result = sum * 0.038));
} else if (inWhichValute === "eur") {
alert((result = sum * 0.032));
} else if (inWhichValute === "rub") {
alert((result = sum * 2.72));
} else if (inWhichValute === "zl") {
alert((result = sum * 0.15));
}
break;case "usd": if (inWhichValute === "uah") { alert((result = sum * 25)); } else if (inWhichValute === "eur") { alert((result = sum * 0.86)); } else if (inWhichValute === "rub") { alert((result = sum * 70)); } else if (inWhichValute === "zl") { alert((result = sum * 4)); } break; default: alert("Проверь правильность написания"); break;
}
} while ((continueAgain = prompt("Хочешь повторить?") !== null));