Skip to content

Commit c9e216a

Browse files
feat: add update classes
1 parent e092b5e commit c9e216a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

part6 (Object-Oriented Programming)/Classes_&_Inheritance.js/classes_&_inheritance.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff 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
1919
const 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
8991
console.log(Car.getCount()); // 2
9092
console.log(myCar.company()); // Error: myCar.company is not a function
9193

92-
9394
/* INFO: get and set (Getters & Setters)
9495
Getters 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
151152
char.age = -5; // Age cannot be negative.
152153
console.log(char.age); // Getting age... -> 30 (unchanged)
153154

154-
155155
// Example of call concepts
156156
class Gadget {
157157
static totalGadgets = 0;

0 commit comments

Comments
 (0)