Skip to content

Update article.md #338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 22, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions 1-js/07-object-properties/02-property-accessors/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ let obj = {

```js
let user = {
name: "Іван",
surname: "Іванов"
name: "Тарас",
surname: "Мельник"
};
```

Тепер ми хочемо додати властивість `fullName`, яка повинна бути `"John Smith"`. Звичайно, ми не хочемо копіювати інформацію, що існує, тому ми можемо реалізувати її як аксесор:
Тепер ми хочемо додати властивість `fullName`, яка повинна бути `"Тарас Мельник"`. Звичайно, ми не хочемо копіювати інформацію, що існує, тому ми можемо реалізувати її як аксесор:

```js run
let user = {
name: "Іван",
surname: "Іванов",
name: "Тарас",
surname: "Мельник",

*!*
get fullName() {
Expand All @@ -49,7 +49,7 @@ let user = {
};

*!*
alert(user.fullName); // Іван Іванов
alert(user.fullName); // Тарас Мельник
*/!*
```

Expand All @@ -73,8 +73,8 @@ user.fullName = "Test"; // Помилка (властивість має лиш

```js run
let user = {
name: "Іван",
surname: "Іванов",
name: "Тарас",
surname: "Мельник",

get fullName() {
return `${this.name} ${this.surname}`;
Expand Down