function generateText(letters, length){
var text = "";
for(i=0; i < length; i++){
var n = getRandomNumber(letters.length - 1);
text = text + letters[n];
}
return text;
}
function getRandomNumber(max){
return Math.round(Math.random() * max);
}
function mission(notification, array, length){
while(true){
alert(notification);
var text = generateText(array, length);
var userText = prompt(text);
if(userText == text){
alert("Все правильно! ");
break;
} else {
alert("Попробуйте еще раз ");
}
}
}
document.addEventListener("DOMContentLoaded", function() {
alert("Вас приветсвует программа для обучения слепой печати ");
mission("Положите 4 пальца левой руки: мезинец, безымянный, средний и указательный - на клавиши ф, ы, в, а. Запомните, что буква а - находится под вашим указательным пальцом, а ф - под мизинцем. \nТеперь неспеша набирайте текст. Постарайтесь не смотреть наклавиатуру. ", ["ф","а"], 10);
alert("Перейдем к следующему уровню");
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.