Skip to content

Commit 22f40dd

Browse files
committed
update script SkillfactoryCoding#8 fix less button && fix modalAlert
1 parent a5c809a commit 22f40dd

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

bjs/08_if_else/script.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,10 @@ function Start()
6060

6161
orderNumberField.innerText = orderNumber++;
6262
answerField.innerText = `${nextAnswerPhrases[0]} ${IntToText(answerNumber)}?`;
63-
64-
if (firstRun)
65-
{
66-
modalStartAlertText.innerText = `Загадайте любое целое число от ${minValue} до ${maxValue}, а я его угадаю`;
67-
modalStartAlert.modal("show");
68-
firstRun = false;
69-
}
63+
64+
modalStartAlertText.innerText = `Загадайте любое целое число от ${minValue} до ${maxValue}, а я его угадаю`;
65+
modalStartAlert.modal("show");
66+
firstRun = false;
7067
}
7168

7269
// Перевод числовой записи в пропись
@@ -172,7 +169,7 @@ document.querySelector('#btnLess').addEventListener('click', function () {
172169
gameRun = false;
173170
} else { //Продолжить поиск ниже
174171
maxValue = answerNumber - 1;
175-
answerNumber = Math.floor((minValue + maxValue) / 2);
172+
answerNumber = Math.ceil((minValue + maxValue) / 2);
176173
orderNumberField.innerText = orderNumber++;
177174

178175
const phraseRandom = Math.round( Math.random() * (nextAnswerPhrases.length - 1));

0 commit comments

Comments
 (0)