63 lines
1.6 KiB
HTML
63 lines
1.6 KiB
HTML
<!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>
|
|
<p id="Nemes"></p>
|
|
<p id="utolso5">A mondat utolsó öt karaktere: </p>
|
|
<p id="tombelemek"></p>
|
|
<p id="elso"></p>
|
|
<script>
|
|
let szoveg = prompt("Mutatkozz be kérlek!");
|
|
let array = szoveg.split(" ");
|
|
let nemes = szoveg.includes("Nemes");
|
|
|
|
if (nemes){
|
|
document.getElementById("Nemes").innerHTML = "Nemesbe jársz!";
|
|
} else {
|
|
document.getElementById("Nemes").innerHTML = "Nem a Nemesbe jársz!";
|
|
}
|
|
|
|
utolso5 = szoveg.slice(szoveg.length - 5, szoveg.length);
|
|
//szoveg = szoveg.slice(0, szoveg.length - 5);
|
|
|
|
|
|
document.getElementById("utolso5").innerHTML += utolso5;
|
|
//console.log(szoveg);
|
|
|
|
array.forEach(element => {
|
|
console.log(element);
|
|
document.getElementById("tombelemek").innerHTML += element + " ";
|
|
});
|
|
|
|
document.getElementById("elso").innerHTML = szoveg.charAt(0);
|
|
|
|
|
|
function fgveny(param1, param2){
|
|
return param1 + param2;
|
|
}
|
|
|
|
let a = fgveny(1,2);
|
|
|
|
function paramnelkulifgveny(){
|
|
return "asd";
|
|
}
|
|
|
|
let b = paramnelkulifgveny();
|
|
|
|
function returnnelkulifgveny(){
|
|
let asd = "";
|
|
console.log("no return");
|
|
}
|
|
|
|
console.log(a);
|
|
console.log(b);
|
|
returnnelkulifgveny();
|
|
//console.log(asd); az asd nak nincs global scopeja
|
|
|
|
</script>
|
|
</body>
|
|
</html> |