improvements
This commit is contained in:
parent
55ba66021b
commit
76b0616727
5 changed files with 21 additions and 23 deletions
|
@ -63,7 +63,7 @@ user.sayHi(); // Hello!
|
|||
```smart header="Object-oriented programming"
|
||||
When we write our code using objects to represent entities, that's called an [object-oriented programming](https://en.wikipedia.org/wiki/Object-oriented_programming), in short: "OOP".
|
||||
|
||||
OOP is a big thing, an interesting science of its own. How to choose the right entities? How to organize the interaction between them? That's architecture, and there are great books on that topic, like "Design Patterns: Elements of Reusable Object-Oriented Software" by E.Gamma, R.Helm, R.Johnson, J.Vissides or "Object-Oriented Analysis and Design with Applications" by G.Booch, and more.
|
||||
OOP is a big thing, an interesting science of its own. How to choose the right entities? How to organize the interaction between them? That's architecture, and there are great books on that topic, like "Design Patterns: Elements of Reusable Object-Oriented Software" by E.Gamma, R.Helm, R.Johnson, J.Vissides or "Object-Oriented Analysis and Design with Applications" by G.Booch, and more.
|
||||
```
|
||||
### Method shorthand
|
||||
|
||||
|
@ -72,14 +72,14 @@ There exists a shorter syntax for methods in an object literal:
|
|||
```js
|
||||
// these objects do the same
|
||||
|
||||
let user = {
|
||||
user = {
|
||||
sayHi: function() {
|
||||
alert("Hello");
|
||||
}
|
||||
};
|
||||
|
||||
// method shorthand looks better, right?
|
||||
let user = {
|
||||
user = {
|
||||
*!*
|
||||
sayHi() { // same as "sayHi: function()"
|
||||
*/!*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue