Skip to content

Commit 21ba2e6

Browse files
committed
Update examples
1 parent cbd9844 commit 21ba2e6

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

JavaScript/9-this.js

+18-12
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
11
'use strict';
22

3-
const city = {
4-
name: 'Kiev',
5-
year: 482,
6-
f1: function() {
7-
return this.name;
8-
},
9-
f2: () => {
10-
return this.name;
11-
},
12-
f3() {
13-
return this.name;
14-
}
3+
const Context = function() {
4+
this.name = 'Marcus';
5+
const city = {
6+
name: 'Kiev',
7+
year: 482,
8+
f1: function() {
9+
return this.name;
10+
},
11+
f2: () => {
12+
return this.name;
13+
},
14+
f3() {
15+
return this.name;
16+
}
17+
};
18+
return city;
1519
};
1620

21+
const city = new Context();
22+
1723
console.log('city.f1() = ' + city.f1());
1824
console.log('city.f2() = ' + city.f2());
1925
console.log('city.f3() = ' + city.f3());

JavaScript/d-decompose.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,4 +193,4 @@ const badIntrospect = (
193193

194194
const iface = { common: { merge, section } };
195195
console.dir(introspect(iface));
196-
console.dir(badIntrospect(iface));
196+
console.dir(badIntrospect(iface), { depth: 5 });

0 commit comments

Comments
 (0)