Skip to content

Commit

Permalink
add repeat_preview_8.1-8.4-JS
Browse files Browse the repository at this point in the history
  • Loading branch information
Sasha-Makar committed Feb 1, 2024
1 parent 0c95100 commit 0a7c213
Show file tree
Hide file tree
Showing 5 changed files with 333 additions and 0 deletions.
12 changes: 12 additions & 0 deletions JS_LESSONS/PREVIEW/p_8.1-8.4/repeat/1/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>repeat_preview_8.1-8.4</title>
</head>
<body>


<script src="main.js"></script>
</body>
</html>
127 changes: 127 additions & 0 deletions JS_LESSONS/PREVIEW/p_8.1-8.4/repeat/1/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
// console.log(222222222);

//Функції конструктори//
console.log('=======Функції конструктори===========');


// function User(name, age, status,wife) {
// this.name = name;
// this.age = age;
// this.status = status;
// // console.log(this);
// this.wife= wife;
//
// }

// function User(name, age, status,wifeName,wifeAge) {
// this.name = name;
// this.age = age;
// this.status = status;
// // console.log(this);
// this.wife= {
// name:wifeName,
// age:wifeAge
// }
//
// }
//
// // let user1 = new User('kokos', 77, true,{name:'asd',age:777111});
// let user2 = new User('kokos', 77, true,'anna',31);
// let user3 = new User('kokos', 77, true);
// // console.log(user1);
// console.log(user2);
// console.log(user3);

// function User(name,age,status,wife) {
// this.name = name;
// this.age=age;
// this.status = status;
// this.wife= wife;
// }
//
// let user = new User('kokos',31,true,{name:'anna',age:33, status: false});
// console.log(user);
//
//
// function User2(name,age,wifeName,wifeAge) {
// this.name=name;
// this.age=age;
// this.wife = {
// name:wifeName,
// age:wifeAge
// }
// }
//
//
// let user2 = new User2('asd', 77, 'qwe', 11);
// console.log(user2);


// function User(name,age,status,wife) {
// this.name=name;
// this.age=age;
// this.status=status;
// this.wife = wife
// }
//
// let user = new User('kokos', 33, true, {name: 'anna', age: 77, status: false});
// console.log(user);
//
//
// function User2(name,age,wifeName,wifeAge) {
// this.name=name;
// this.age=age;
// this.wife = {
// name:wifeName,
// age:wifeAge
// }
// this.greeting = ()=>{
// console.log('hi');
// }
// }
//
// let user2 = new User2('kokokokok', 444, 'anya', 77777);
// console.log(user2);
// user2.greeting();


function User(name, age, wife, son) {
this.name = name;
this.age = age;
this.wife = wife;
this.son = son;
this.greeting = () => {
console.log('hi, my son name is' + ' ' + son.name);
}
}

let user = new User('kokos', 35, {name: 'olya', age: 31}, {name: 'Fsd'});
console.log(user);
user.greeting();




function User2(name,age,wifeName,wifeAge) {
this.name=name;
this.age=age;
this.wife= {
name:wifeName,
age : wifeAge,
greeting(){
console.log(this.name);
}
}
}

let user2 = new User2('koko', 77, 'ania', 75);
console.log(user2);
user2.wife.greeting();


// //prototype call apply bind
// console.log('======prototype call apply bind=======');




96 changes: 96 additions & 0 deletions JS_LESSONS/PREVIEW/p_8.1-8.4/repeat/2/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>2</title>
</head>
<body>


<script>
// console.log(22);
//prototype call apply bind
console.log('======prototype call apply bind=======');

function User(name,age) {
this.name=name;
this.age=age;
this.greeting= function () {
console.log(`hi my name is ${this.name}`);
}
}

let user = new User('kokos', 33);
console.log(user);
user.greeting();

</script>











<script>


// console.log('qweeeeww');
//
//
// let user1 = new User('vasya', 31);
// console.log(user1);
//
// user1.status = false;
// console.log(user1);
//
// let user2 = new User('petya', 55);
// console.log(user2);


// User.prototype.status = false;
// let user1 = new User('asd', 21);
// console.log(user1);
// console.log(user1.status);
//
//
// console.log(User);
//
// User.prototype.greeting2 = function () {
// console.log(`aloha,my age is ${this.age}`);
// }
//
// let user2 = new User('asd', 77);
// console.log(user2);
// user2.greeting2();


let user1 = new User('qwe', 77);
console.log(user1);
user1.greeting2 = function () {
return`aloha,my age is ${this.age}`;
}

console.log(user1);
user1.greeting();
console.log(user1.greeting2());


let user2 = new User('qweertty', 78787878787);
console.log(user2);
user2.greeting();
// console.log(user2.greeting2());
console.log(user1.greeting2.apply(user2));
user2.greeting2()
</script>





</body>
</html>
13 changes: 13 additions & 0 deletions JS_LESSONS/PREVIEW/p_8.1-8.4/repeat/3/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>3</title>
</head>
<body>


<script src="main.js"></script>

</body>
</html>
85 changes: 85 additions & 0 deletions JS_LESSONS/PREVIEW/p_8.1-8.4/repeat/3/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// console.log(22);




// class User {
//
//
// constructor(name,age) {
// this.name=name;
// this.age=age;
// }
// greeting(){
// return 'hello my name is '+this.name;
// }
// }
//
// let user = new User('koko', 33);
// console.log(user);
// console.log(user.greeting());


class User{

constructor(name, age) {
this.name = name;
this.age = age;
}
// static greeting(){
// return 'hello my name is '+this.name;
// }
work(){
return 'qeqwfargdsbdsdf'
}
}


// console.log(User.greeting());


class Customer extends User{

constructor(name, age, password) {
super(name, age);
this.password = password;
}

work() {
return super.work();
}
}


let customer = new Customer('asd', 111, '123');
console.log(customer);
console.log(customer.work());





// Прототипи об'єктів
console.log('===Прототипи об\'єктів====');


console.log({});

console.log({}.__proto__);


let user = {
name: 'aaa',
age:111
}


let user2 = Object.create(user);
console.log(user2);
console.log(user2.name);
console.log(user2.age);
user2.foobar = 'qwee';
console.log(user2);

console.log(user2.hasOwnProperty('name'));
console.log(user2.hasOwnProperty('foobar'));

0 comments on commit 0a7c213

Please sign in to comment.