Commit e21da739 authored by Nurasyl's avatar Nurasyl

init

parents
function getRandomNum() { return Math.round(Math.random() * 9) };
function mathOper(a, b) { return (a * b) };
function showStatic(correct, unCorrect, total) {
alert(`
Общ. - ${total}
Верные ответы - ${correct}
Не верные ответы - ${unCorrect}
`);
};
let correct = [];
let unCorrect = [];
while(true) {
let firstNum = getRandomNum();
let secondNum = getRandomNum();
let total = mathOper(firstNum, secondNum);
const answer = prompt(`Сколько будет ${firstNum} * ${secondNum}?`);
if(!answer) {
showStatic(correct.length, unCorrect.length, correct.length + unCorrect.length);
break;
} else {
if(isNaN(parseInt(answer))) {
alert("Введи число!");
} else {
if(parseInt(answer) !== parseInt(total)) {
unCorrect.push(answer);
} else {
correct.push(answer);
};
};
};
};
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="./JS/index.js"></script>
<title>Document</title>
</head>
<body>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment