Skip to content

Commit 045a3b6

Browse files
author
Wakidur Rahaman
committed
Merge remote-tracking branch 'origin/main' into feat/array-02
2 parents a55c68c + f75dad1 commit 045a3b6

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

src/data-structure/array/exercise.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Reference type
2+
// Context
3+
// Scope
4+
// Instantiation
5+
6+
/**
7+
* Reference type
8+
* Context
9+
* Scope
10+
* Instantiation
11+
*/
12+
13+
// Reference
14+
const object1 = { value: 10 };
15+
const object2 = object1; // Reference: Objects are called the reference types an javascript.
16+
const object3 = { value: 15 };
17+
18+
// Context
19+
20+
const object4 = {
21+
a: function () {
22+
console.log(this);
23+
},
24+
};
25+
26+
// Instantiation
27+
28+
class Player {
29+
constructor(name, type) {
30+
this.name = name;
31+
this.type = type;
32+
}
33+
34+
introduce() {
35+
console.log(`Hi I am ${this.name}, I'm a ${this.type}`);
36+
}
37+
}
38+
39+
class Wizard extends Player {
40+
constructor(name, type) {
41+
super(name, type);
42+
}
43+
44+
play() {
45+
console.log(`WEEEEE I'm a ${this.type}`);
46+
}
47+
}
48+
49+
const wizardInit = new Wizard("Shelly", "Programmer"); // Instantiation.

0 commit comments

Comments
 (0)