added today's work
This commit is contained in:
90
24_09_16/KonyvtarObjektumFeladat.html
Normal file
90
24_09_16/KonyvtarObjektumFeladat.html
Normal file
@@ -0,0 +1,90 @@
|
||||
<!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="kiir"></p>
|
||||
<p id="kiir2"></p>
|
||||
<p id="kiir3"></p>
|
||||
<p id="kiir4"></p>
|
||||
<p id="kiir5"></p>
|
||||
<script>
|
||||
|
||||
let konyv = new Object();
|
||||
konyv.cim = "";
|
||||
konyv.szerzo = "";
|
||||
konyv.megjelenes = 0;
|
||||
konyv.elerheto = false;
|
||||
konyv.kolcsonzo = "";
|
||||
|
||||
let gyurukUra = {
|
||||
cim : "Gyűrűk ura",
|
||||
szerzo : "J. R. R. Tolkein",
|
||||
megjelenes : 1954,
|
||||
kolcsonzo_neve : undefined,
|
||||
elerheto : true,
|
||||
|
||||
kikolcsonzes : function(kolcsonzo_neve){
|
||||
if (this.elerheto) {
|
||||
this.kolcsonzo_neve = kolcsonzo_neve;
|
||||
this.elerheto = !this.elerheto;
|
||||
return `A ${this.cim} kikölcsönözve ${kolcsonzo_neve} által.`;
|
||||
} else {
|
||||
return `A ${this.cim} című könyv nem elérhatő jelenleg.`;
|
||||
}
|
||||
},
|
||||
|
||||
visszahozas : function(){
|
||||
this.kolcsonzo_neve = undefined;
|
||||
this.elerheto = !this.elerheto;
|
||||
},
|
||||
|
||||
informacio : function(){
|
||||
/*
|
||||
let elerhetoseg_text = "";
|
||||
if (this.elerheto){
|
||||
elerhetoseg_text = "elérhető"
|
||||
} else {
|
||||
elerhetoseg_text = "nem elérhető"
|
||||
}
|
||||
*/
|
||||
return `Cím: ${this.cim}<br> Szerző: ${this.szerzo}<br> Megjelenési év: ${this.megjelenes}<br> Elérhetőség: ${this.elerheto ? "elérhető" : "nem elérhető"}<br> Kölcsönző neve: ${this.kolcsonzo_neve}`;
|
||||
},
|
||||
}
|
||||
|
||||
document.getElementById("kiir").innerHTML = gyurukUra.informacio();
|
||||
gyurukUra.kikolcsonzes("PATAI");
|
||||
document.getElementById("kiir2").innerHTML = gyurukUra.informacio();
|
||||
gyurukUra.visszahozas();
|
||||
document.getElementById("kiir3").innerHTML = gyurukUra.informacio();
|
||||
|
||||
alert(Object.keys(gyurukUra));
|
||||
alert(Object.values(gyurukUra));
|
||||
alert(Object.entries(gyurukUra));
|
||||
|
||||
let tomb = ["Nigga", "Patai", "starwars"];
|
||||
let asd = document.getElementById("kiir4");
|
||||
|
||||
for (let index = 0; index < tomb.length; index++) {
|
||||
const element = tomb[index];
|
||||
asd.innerHTML += element;
|
||||
}
|
||||
|
||||
document.getElementById("kiir5").innerHTML = tomb.join(', ');
|
||||
tomb.pop();
|
||||
tomb.push(tomb.at(0));
|
||||
tomb.shift();
|
||||
tomb.unshift(tomb.at(0));
|
||||
tomb.concat(tomb);
|
||||
tomb.sort();
|
||||
tomb.reverse();
|
||||
|
||||
alert(tomb.toString());
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user