8000 fix grammar mistakes · gramos-encora/learn-javascript@4d59771 · GitHub
[go: up one dir, main page]

8000 Skip to content

Commit 4d59771

Browse files
deyantomovsumn2u
authored andcommitted
fix grammar mistakes
1 parent 9384595 commit 4d59771

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

en/classes/composition.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Composition
22

3-
Composition is useful for creating "has-a" relationships which ensure loose coupling and flexibility. If we imagine that our class is a wall, the classes that make it up via composition are like bricks - smaller and more manageable components.
3+
Composition is useful for creating "has-a" relationships that ensure loose coupling and flexibility. If we imagine that our class is a wall, the classes that make it up via composition are like bricks - smaller and more manageable components.
44

55
## Benefits of composition
66

@@ -37,11 +37,11 @@ let myLibrary = new Library();
3737
console.log(myLibrary.add(myBook)); // The Great Gatsby was added to the library.
3838
```
3939

40-
In the example above, instances of the `Book` class are used to create the larger `Library` class. Composition is used to create a "has-a" relationship between the two classes (a library has books inside it) which ensures loose coupling. Changes to the `Book` class won't be reflected on the `Library` class and vice versa.
40+
In the example above, instances of the `Book` class are used to create the larger `Library` class. Composition is used to create a "has-a" relationship between the two classes (a library has books inside it), which ensures loose coupling. Changes to the `Book` class won't be reflected on the `Library` class, and vice versa.
4141

4242
## Composition vs Inheritance
4343

44-
While inheritance creates an "is-a" relationship (e.g. a `Car` is a `Vehicle`), composition creates a "has-a" relationship (e.g. a `Car` has an `Engine`). Here are some pros and cons for using both:
44+
While inheritance creates an "is-a" relationship (e.g., a `Car` is a `Vehicle`), composition creates a "has-a" relationship (e.g., a `Car` has an `Engine`). Here are some pros and cons for using both:
4545

4646
+ Inheritance
4747

0 commit comments

Comments
 (0)
0