-
Notifications
You must be signed in to change notification settings - Fork 0
HM12 #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
GeorgeTsendra
wants to merge
2
commits into
master
Choose a base branch
from
homework-12
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
HM12 #15
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en" dir="ltr"> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <title></title> | ||
| </head> | ||
| <body> | ||
| <script type="text/javascript" src="js.js"> | ||
|
|
||
| </script> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| // 'use strict'; | ||
|
|
||
| /* | ||
| * TASK ! ! ! | ||
| * Сделайте пожалуйста с теми навыками которые у вас есть ТЕЛЕФОННЫЙ СПРАВОЧНИК | ||
| * | ||
| * Task 0 !!!! Didn't done!!! | ||
| * | ||
| * Создайте функцию конструктор Http, которая будет иметь 2 метода | ||
| * | ||
| * createServer() - принимает один аргумент функцию с двумя параметрами ctx и next | ||
| * ctx: Object { | ||
| * req: Object | ||
| * PORT: number | ||
| * url: string | ||
| * res: Object | ||
| * status: number, | ||
| * message: string, | ||
| * header: Object { | ||
| * content-type:application/json | ||
| * } | ||
| * } | ||
| * next: Function | ||
| * | ||
| * | ||
| * при вызове listen(PORT, host) - в консоле должна отобразится надпись | ||
| * "Server running on https://host:port" | ||
| * и вызваться переданная в createServer функция | ||
| * | ||
| * | ||
| * методы нужно вызывать через chain | ||
| * после вызова метода listen() - должна вызываться переданная в createServer | ||
| * первая функция и возвращать объект и функцию | ||
| * | ||
| * */ | ||
|
|
||
| function Http() {}; | ||
|
|
||
|
|
||
| Http.prototype.createServer = function(fn) { | ||
| console.log(fn); | ||
| } | ||
|
|
||
| Http.prototype.listen = function(PORT, host) { | ||
| console.log(`Server running on https://${host}:${PORT}`); | ||
|
|
||
|
|
||
| }; | ||
|
|
||
| // const server = new Http().createServer(function(ctx, next) { | ||
| // console.log(ctx); | ||
| // }).listen(3000, 'localhost'); | ||
|
|
||
|
|
||
| // server.createServer(function(ctx, next) { | ||
| // console.log(ctx); | ||
| // }) | ||
|
|
||
|
|
||
| // console.log(server); | ||
| // TASK 1 | ||
| // Создать класс Human, у которого будут свойства обычного человека: | ||
| // имя, возраст, пол, рост, вес. | ||
| // Используя прототипное наследование создать дочерние классы Worker | ||
| // (дописать в них поля места работы, зарплата, метод "работать") | ||
| // и Student (дописать поля места учебы, стипендией, метод "смотреть сериалы") | ||
| // | ||
| // Создать несколько экземпляров классов Worker и Student, вывести их в консоль. | ||
| // Убедиться что они имеют поля родительского класса Human | ||
|
|
||
|
|
||
| function Human(name,age,sex,hight,weight) { | ||
| this.name = name; | ||
| this.age = age; | ||
| this.sex = sex; | ||
| this.hight = hight; | ||
| this.weight = weight; | ||
| } | ||
| function Worker(sallary, keyshiya) { | ||
| this.sallary = sallary; | ||
| this.workPlace = keyshiya; | ||
| this.arbeiten = function() { | ||
| console.log(`arbeite macht frie`); | ||
| }; | ||
| } | ||
| function Student(university, scholarship) { | ||
| this.university = university; | ||
| this.scholarship = scholarship; | ||
| this.lookingOfTVSeries = function() { | ||
|
||
| console.log(`Say: Lannisters always pay their debts`); | ||
| } | ||
| } | ||
| Worker.prototype = new Human(); | ||
|
||
| Student.prototype = new Human(); | ||
| let studentExemplar1 = new Student(`HPI`,`-1200`); | ||
| let workerExemplar1 = new Worker(`400$`,`somewhere`); | ||
| let humanExample1 = new Human(`Vasia`,`18`,`man`,`165`,`55`); | ||
|
|
||
| console.log(studentExemplar1); | ||
| console.log(workerExemplar1); | ||
| console.log(humanExample1); | ||
|
|
||
| // @SUPER | ||
|
|
||
| /* | ||
| * | ||
| * TASK 0 | ||
| * Создайте функцию обертку над другой функцией | ||
| * Каждый раз при вызове внутренней функции в консоле будут отображаться аргументы функции | ||
| * которую мы обернули | ||
| * | ||
| */ | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's better to make that method as prototype inheritance