File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
part6 (Object-Oriented Programming)/Classes_&_Inheritance.js Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ class Person {
13
13
greet ( ) {
14
14
console . log ( `Hello, my name is ${ this . name } ` ) ;
15
15
}
16
- } ;
16
+ }
17
17
18
18
// creating actual people (objects) from the blueprint
19
19
const person1 = new Person ( "Alice" , 25 ) ;
@@ -51,7 +51,9 @@ class Developer extends User {
51
51
}
52
52
53
53
code ( ) {
54
- console . log ( `${ this . name } writes code in ${ this . language } & his age is ${ this . age } ` ) ;
54
+ console . log (
55
+ `${ this . name } writes code in ${ this . language } & his age is ${ this . age } ` ,
56
+ ) ;
55
57
}
56
58
}
57
59
@@ -70,7 +72,7 @@ class Car {
70
72
71
73
constructor ( model ) {
72
74
this . model = model ;
73
- Car . count ++
75
+ Car . count ++ ;
74
76
}
75
77
76
78
static company ( ) {
@@ -89,7 +91,6 @@ console.log(Car.company()); // Toyota
89
91
console . log ( Car . getCount ( ) ) ; // 2
90
92
console . log ( myCar . company ( ) ) ; // Error: myCar.company is not a function
91
93
92
-
93
94
/* INFO: get and set (Getters & Setters)
94
95
Getters and setters in javascript are special methods that allow you to define custom behaviour when accessing or setting object properties.
95
96
*/
@@ -151,7 +152,6 @@ console.log(char.age); // Getting age... -> 30
151
152
char . age = - 5 ; // Age cannot be negative.
152
153
console . log ( char . age ) ; // Getting age... -> 30 (unchanged)
153
154
154
-
155
155
// Example of call concepts
156
156
class Gadget {
157
157
static totalGadgets = 0 ;
You can’t perform that action at this time.
0 commit comments