File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change
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.
You can’t perform that action at this time.
0 commit comments