added maganhangzo szamlalo
This commit is contained in:
parent
8550ee862a
commit
3adf9b074b
42
24_09_17/Maganhangzohtml.html
Normal file
42
24_09_17/Maganhangzohtml.html
Normal file
|
@ -0,0 +1,42 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
let szoveg = prompt("Add meg a szöveget!");
|
||||
let maganhangzok = [['a',0], ['á',0],['e',0],['é',0],['i',0],['í',0],['o',0],['ó',0],['ö',0],['ő',0],['u',0],['ú',0],['ü',0],['ű',0]];
|
||||
|
||||
for (let index = 0; index < szoveg.length; index++) {
|
||||
let karakter = szoveg[index];
|
||||
|
||||
for (let maganhangzo = 0; maganhangzo < maganhangzok.length; maganhangzo++) {
|
||||
let mhangzo = maganhangzok[maganhangzo][0];
|
||||
if (karakter.toLowerCase() == mhangzo){
|
||||
maganhangzok[maganhangzo][1]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
function maganhangzoDarab(){
|
||||
let darab = 0;
|
||||
for (let index = 0; index < maganhangzok.length; index++) {
|
||||
let element = maganhangzok[index][1];
|
||||
darab += element;
|
||||
}
|
||||
return darab;
|
||||
}
|
||||
|
||||
let maganhangzo_darab = maganhangzoDarab();
|
||||
|
||||
alert(maganhangzo_darab);
|
||||
|
||||
alert(maganhangzok.join('\n'));
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user