Commit 8c409948 authored by Nurasyl's avatar Nurasyl

init

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