var i=0;
function checkUsersKey (levelText) {
var theEnd = false;i++;console.log(" theEnd: "+theEnd+" i: "+i+" eventKey "+keyName);
var counterLetters = 0;
var keyName;
while (theEnd != true ) {
document.addEventListener("keypress", (event) => {
let symbolsCounter = 0;
let mistakesCounter = 0;
keyName = event.key;
})
if(levelText[counterLetters] == keyName){
console.log(" true "+"******success**********");
}
theEnd = true;
}
};var call = checkUsersKey("y");
setInterval(function(){i++;console.log(i);return checkUsersKey(121)},500);