Last active
November 27, 2018 17:13
-
-
Save nestordelirium/4745d8d42d0ab06e0060265d42252197 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alert('Hej. Napisz tu litere polskiego alfabetu i zobacz, jak ta litera sie pisze w jezyku ukrainskim') | |
function isRussian(a) { | |
return /[А-Яа-я]/.test(a) | |
}; | |
const data = { | |
'a' : 'а', | |
'b' : 'б', | |
'c' : 'ц', | |
'ć' : 'чь', | |
'cz': 'ч', | |
'd' : 'д', | |
'e' : 'е', | |
'ę' : 'ен', | |
'f' : 'ф', | |
'g' : 'г', | |
'h' : 'х', | |
'i' : 'і', | |
'j' : 'й', | |
'k' : 'к', | |
'l' : 'л', | |
'ł' : 'уви', | |
'm' : 'м', | |
'n' : 'н', | |
'ń' : 'нь', | |
'o' : 'о', | |
'ó' : 'у', | |
'p' : 'п', | |
'r' : 'р', | |
'rz' : 'ж', | |
's' : 'с', | |
'sz' : 'ш', | |
'ś' : 'сь', | |
't' : 'т', | |
'u' : 'у', | |
'w' : 'в', | |
'y' : 'и', | |
'z' : 'з', | |
'ż' : 'зь' | |
}; | |
// тут можно цыкл использовать | |
processLeteer(); | |
function processLeteer() { | |
let polishLetter = prompt(); | |
if (!polishLetter) { | |
return alert('nie wpisalesz litere'); | |
} | |
// если русский - выводим сообщение об этом | |
const length = polishLetter.length; | |
if (length >= 3) { | |
return alert('only one letter or cz rz sz'); | |
} | |
if (length === 1 || length === 2) { | |
return alert(data[polishLetter]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment