-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathobject.js
More file actions
86 lines (63 loc) · 1.42 KB
/
Copy pathobject.js
File metadata and controls
86 lines (63 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
const person = {
firstName: 'arvind',
lastName: 'kumar',
age: 29,
fullName: function () {
return this.firstName + ' ' + this.lastName;
},
};
console.log(person.fullName());
console.log(person.age);
function express() {
return {
use: function (middleware) {
},
get: function (path, fn) {
// some how the library access the req param
// perform some logic or check
// finally calls the callback fn
fn('req', 'res');
},
};
}
const app = express();
app.get('/users', function (req, res) {
});
// person obj in es6
class Person {
constructor(firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
fullName = function () {
return `${this.firstName} ${this.lastName}`;
}
}
let p1 = new Person('anurag', 'kumar');
console.log(p1);
class AdminPerson extends Person {
constructor(firstName, lastName, isAdmin) {
super(firstName, lastName);
this.isAdmin = isAdmin;
}
}
let ap1 = new AdminPerson('arvind', 'kumar', true);
console.log(ap1);
class Options {
constructor(color, thickness) {
this.color = color;
this.thickness = thickness;
}
}
class Graph {
constructor(option) {
this.option = option;
}
draw = function () {
console.log('From graph draw function', this.option.color, this.option.thickness);
}
}
let options = new Options('red', '2cm');
let g = new Graph(options);
g.draw()
console.log(g)