Skip to content
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

7-arrays with * #304

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions homeworks/andrii.morozov_AndriiMorozov88/7-arrays/class.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
class Auto {
constructor(autoParams) {
this.autoParams = autoParams;
AndriiMorozov88 marked this conversation as resolved.
Show resolved Hide resolved
}

show() {
console.log(this.autoParams);
}
}

class Engine {
constructor(volume, power) {
this.volume = volume;
this.power = power;
}
}

class Size {
constructor(length, width, height) {
this.length = length;
this.width = width;
this.height = height;
}
}

class Tire {
constructor(radius, width) {
this.radius = radius;
this.width = width;
}
}
const daf430 = {
name: 'DAF',
engine: new Engine('12.9 l', '350 kWt'),
tire: new Tire('315', '22.5'),
size: new Size('8620 mm', '2500 mm', '3700 mm'),
};

const ca8644ca = new Auto(daf430);
ca8644ca.show();
30 changes: 30 additions & 0 deletions homeworks/andrii.morozov_AndriiMorozov88/7-arrays/http.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// const myUrl = 'https://jsonplaceholder.typicode.com/posts';
const https = require('https');

let body = '';

const myUrl = process.argv[2];
class HTTP {
constructor(url) {
this.url = url;
}

async getData() {
https.get(this.url, (res) => this.fetchContent(res));
}

fetchContent(res) {
res.on('data', (data) => this.createContent(data));
res.on('end', () => this.showContent(body));
}

createContent(data) {
body += data;
}

showContent(content) {
console.log(content);
}
}
const json = new HTTP(myUrl);
json.getData();