TODO finish RPS
This commit is contained in:
parent
16d34ecf8a
commit
4809dbce1a
BIN
24_09_13/24_09_13 - Frontend.pptx
Normal file
BIN
24_09_13/24_09_13 - Frontend.pptx
Normal file
Binary file not shown.
92
24_09_13/index.html
Normal file
92
24_09_13/index.html
Normal file
|
@ -0,0 +1,92 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>TITLE</title>
|
||||
</head>
|
||||
<body>
|
||||
<p id="car"></p>
|
||||
<p id="car2"></p>
|
||||
<p id="car_engine"></p>
|
||||
<p id="car_engine_fuel"></p>
|
||||
<p id="kiiras"></p>
|
||||
<p id="carinfo"></p>
|
||||
<p id="kiir2"></p>
|
||||
<p id="kiir3"></p>
|
||||
<p id="kiir4"></p>
|
||||
<script>
|
||||
let kiiras = document.getElementById("kiiras");
|
||||
//objeltum literál
|
||||
let car = {
|
||||
// mezők
|
||||
name : "Fiat",
|
||||
model : "500",
|
||||
engine : {
|
||||
horsepower : 110,
|
||||
fuel: "benzin",
|
||||
},
|
||||
|
||||
//metódusok
|
||||
start : function(){
|
||||
return "Autó elindul!";
|
||||
},
|
||||
|
||||
drive : function(){
|
||||
return "Autó megy!";
|
||||
},
|
||||
|
||||
kiir : function(){
|
||||
kiiras.innerHTML = `Név: ${car.name} <br>`;
|
||||
kiiras.innerHTML += `Megy az autó? ${car.drive()} <br>`;
|
||||
kiiras.innerHTML += `Mennyi a lóereje: ${car.engine.horsepower} <br>`;
|
||||
},
|
||||
|
||||
carInfo : function(){
|
||||
return this.name + ", " + this.model;
|
||||
}
|
||||
}
|
||||
|
||||
let car2 = new Object();
|
||||
car2.name = "Fiat";
|
||||
car2.model = "500";
|
||||
car2.start = function(){
|
||||
return "Autó elindul!";
|
||||
};
|
||||
car2.drive = function(){
|
||||
return "Autó megy!";
|
||||
};
|
||||
|
||||
document.getElementById("car").innerHTML = car.drive;
|
||||
document.getElementById("car2").innerHTML = car2.model;
|
||||
document.getElementById("car_engine").innerHTML = car.engine.horsepower;
|
||||
|
||||
//undorítóbb módon való elérés
|
||||
document.getElementById("car_engine_fuel").innerHTML = car["engine"]["fuel"];
|
||||
|
||||
car.kiir();
|
||||
document.getElementById("carinfo").innerHTML = car.carInfo();
|
||||
|
||||
//tömbök
|
||||
let tomb1 = ["alma", "körte", car, 1, 2.4];
|
||||
let tomb2 = new Array("alma", "a", car2, 3);
|
||||
|
||||
let kiir2 = document.getElementById("kiir2");
|
||||
tomb1.forEach(element => {
|
||||
kiir2.innerHTML += element + ", ";
|
||||
});
|
||||
|
||||
tomb2[0] = "szilva";
|
||||
let kiir3 = document.getElementById("kiir3").innerHTML = tomb2[0] + " " + tomb2[tomb2.length - 1];
|
||||
|
||||
|
||||
let kiir4 = document.getElementById("kiir4");
|
||||
for (let index = 0; index < tomb2.length; index++) {
|
||||
const element = tomb2[index];
|
||||
kiir4.innerHTML += element + " ";
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
38
24_09_13/kopapirollo.html
Normal file
38
24_09_13/kopapirollo.html
Normal file
|
@ -0,0 +1,38 @@
|
|||
<!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="USER"></p>
|
||||
<p id="COMPUTER"></p>
|
||||
<script>
|
||||
let weapon;
|
||||
let weapons = ["kő", "papír", "olló"];
|
||||
let computer_choice = weapons[((Math.random() * 10) % 3).toFixed(0)];
|
||||
do{
|
||||
weapon = prompt("Kő - papír - olló").toLowerCase();
|
||||
}while(!weapons.includes(weapon));
|
||||
|
||||
|
||||
|
||||
|
||||
document.getElementById("USER").innerHTML = weapon;
|
||||
document.getElementById("COMPUTER").innerHTML = computer_choice;
|
||||
|
||||
|
||||
|
||||
switch (weapon) {
|
||||
case value:
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user