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 {
1313 greet ( ) {
1414 console . log ( `Hello, my name is ${ this . name } ` ) ;
1515 }
16- } ;
16+ }
1717
1818// creating actual people (objects) from the blueprint
1919const person1 = new Person ( "Alice" , 25 ) ;
@@ -51,7 +51,9 @@ class Developer extends User {
5151 }
5252
5353 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+ ) ;
5557 }
5658}
5759
@@ -70,7 +72,7 @@ class Car {
7072
7173 constructor ( model ) {
7274 this . model = model ;
73- Car . count ++
75+ Car . count ++ ;
7476 }
7577
7678 static company ( ) {
@@ -89,7 +91,6 @@ console.log(Car.company()); // Toyota
8991console . log ( Car . getCount ( ) ) ; // 2
9092console . log ( myCar . company ( ) ) ; // Error: myCar.company is not a function
9193
92-
9394/* INFO: get and set (Getters & Setters)
9495Getters and setters in javascript are special methods that allow you to define custom behaviour when accessing or setting object properties.
9596*/
@@ -151,7 +152,6 @@ console.log(char.age); // Getting age... -> 30
151152char . age = - 5 ; // Age cannot be negative.
152153console . log ( char . age ) ; // Getting age... -> 30 (unchanged)
153154
154-
155155// Example of call concepts
156156class Gadget {
157157 static totalGadgets = 0 ;
You can’t perform that action at this time.
0 commit comments