Commit 8c409948 authored by Nurasyl's avatar Nurasyl

init

parent e21da739
...@@ -8,8 +8,21 @@ function showStatic(correct, unCorrect, total) { ...@@ -8,8 +8,21 @@ function showStatic(correct, unCorrect, total) {
`); `);
}; };
function iter(arr, num) {
for(let i = 0; i < arr.length; i++) {
if(i === parseInt(num)) arr[i].total.push(parseInt(num));
};
};
function iterObject(arr, a, b) {
iter(arr, a);
iter(arr, b);
};
let correct = []; let correct = [];
let unCorrect = []; let unCorrect = [];
let totalUnCorrect = [{total: []},{total: []},{total: []},{total: []},{total: []},{total: []},{total: []},{total: []},{total: []},{total: []}];
while(true) { while(true) {
let firstNum = getRandomNum(); let firstNum = getRandomNum();
...@@ -20,12 +33,14 @@ while(true) { ...@@ -20,12 +33,14 @@ while(true) {
if(!answer) { if(!answer) {
showStatic(correct.length, unCorrect.length, correct.length + unCorrect.length); showStatic(correct.length, unCorrect.length, correct.length + unCorrect.length);
console.log(totalUnCorrect);
break; break;
} else { } else {
if(isNaN(parseInt(answer))) { if(isNaN(parseInt(answer))) {
alert("Введи число!"); alert("Введи число!");
} else { } else {
if(parseInt(answer) !== parseInt(total)) { if(parseInt(answer) !== parseInt(total)) {
iterObject(totalUnCorrect, firstNum, secondNum);
unCorrect.push(answer); unCorrect.push(answer);
} else { } else {
correct.push(answer); correct.push(answer);
......
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