65 lines
1.6 KiB
HTML
65 lines
1.6 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html lang="hu">
|
||
|
|
||
|
<head>
|
||
|
<meta charset="UTF-8">
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
<title>Document</title>
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
<script>
|
||
|
let car = {
|
||
|
name: "Fiat",
|
||
|
model: "500",
|
||
|
|
||
|
start: function () {
|
||
|
return "Autó elindul!";
|
||
|
},
|
||
|
|
||
|
drive: function () {
|
||
|
return "Autó megy!";
|
||
|
}
|
||
|
}
|
||
|
//---------------------------------------------------
|
||
|
class Szemely{
|
||
|
static faj = "Ember";
|
||
|
nev = "Sanyi";
|
||
|
kor = 12;
|
||
|
}
|
||
|
let szemely1 = new Szemely();
|
||
|
console.log(Szemely.faj);
|
||
|
//---------------------------------------------------
|
||
|
class Ember{
|
||
|
constructor(nev, kor){
|
||
|
this.nev = nev;
|
||
|
this.kor = kor;
|
||
|
}
|
||
|
}
|
||
|
let ember1 = new Ember("Sanyi", 12);
|
||
|
console.log(ember1.nev);
|
||
|
//---------------------------------------------------
|
||
|
class Valaki{
|
||
|
constructor(nev, kor){
|
||
|
this._nev = nev;
|
||
|
this._kor = kor;
|
||
|
}
|
||
|
}
|
||
|
let valaki1 = new Valaki("Péter", 22);
|
||
|
console.log(valaki1._nev);
|
||
|
//---------------------------------------------------
|
||
|
class Vki{
|
||
|
constructor(nev, kor){
|
||
|
this.nev = nev;
|
||
|
this.kor = kor;
|
||
|
}
|
||
|
static udvozles(){
|
||
|
return "Üdvözöllek!";
|
||
|
}
|
||
|
}
|
||
|
let vki1 = new Vki("Péter", 22);
|
||
|
console.log(Vki.udvozles());
|
||
|
</script>
|
||
|
</body>
|
||
|
|
||
|
</html>
|