GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Optional chaining ?. by didostap · Pull Request #146 · javascript-tutorial/uk.javascript.info

Conversation

@didostap

@didostap didostap commented Jul 21, 2021

Copy link
Copy Markdown
Contributor

No description provided.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@didostap
Optional chaining ?.
6da2c23
@javascript-translate-bot javascript-translate-bot added the review needed label Jul 21, 2021
@CLAassistant

CLAassistant commented Jul 21, 2021 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

dolgachio
dolgachio reviewed Jul 21, 2021
View reviewed changes

@dolgachio dolgachio left a comment

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Дякую за чудовий переклад!

Будь-ласка, подивіться мої коментарі і пропозиції.
Деякі з них обов'язково потрібно виправити (друкарські помилки), інші після того, як пулл реквест подивиться
@tarasyyyk ;)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread 1-js/04-object-basics/07-optional-chaining/article.md Outdated
[recent browser="new"]

The optional chaining `?.` is a safe way to access nested object properties, even if an intermediate property doesn't exist.
Опціональний ланцюжок `?.` - це безпечний спосіб доступу до влатсивостей об'єктів з вкладеностями, навіть якщо проміжних властивостей не існує.

@dolgachio dolgachio Jul 21, 2021

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Опціональний ланцюжок `?.` - це безпечний спосіб доступу до влатсивостей об'єктів з вкладеностями, навіть якщо проміжних властивостей не існує.
Опціональний ланцюжок `?.` -- це безпечний спосіб доступу до вкладених властивостей об'єктів, навіть якщо проміжних властивостей не існує.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread 1-js/04-object-basics/07-optional-chaining/article.md Outdated
В більшості наших користувачів є адреса `user.address` з вулицею `user.address.street`, проте дехто вирішив взагалі не вказувати адресу.

In such case, when we attempt to get `user.address.street`, and the user happens to be without an address, we get an error:
Отож якщо користувач не вказав адресу, а ми в свою чергу намагаємось отримати доступ до властивості `user.address.street` отримаємо помилку.

@dolgachio dolgachio Jul 21, 2021

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Отож якщо користувач не вказав адресу, а ми в свою чергу намагаємось отримати доступ до властивості `user.address.street` отримаємо помилку.
Отож якщо користувач не вказав адресу, а ми в свою чергу спробуємо отримати доступ до властивості `user.address.street`, то отримаємо помилку.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread 1-js/04-object-basics/07-optional-chaining/article.md Outdated
Це очікуваний розвиток подій, так працює JavaScript. Оскільки `user.address` є `undefined`, то і спроба отримати `user.address.street` закінчується помилкою.

In many practical cases we'd prefer to get `undefined` instead of an error here (meaning "no street").
Проте в багатьох життєвих ситуаціях було б набагато зручніше отримати просто `undefined` ("немає вулиці").

@dolgachio dolgachio Jul 21, 2021

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Проте в багатьох життєвих ситуаціях було б набагато зручніше отримати просто `undefined` ("немає вулиці").
Проте в багатьох життєвих ситуаціях було б набагато зручніше отримати просто `undefined`, що буде означати "немає вулиці".

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread 1-js/04-object-basics/07-optional-chaining/article.md Outdated
Проте в багатьох життєвих ситуаціях було б набагато зручніше отримати просто `undefined` ("немає вулиці").

...And another example. In the web development, we can get an object that corresponds to a web page element using a special method call, such as `document.querySelector('.elem')`, and it returns `null` when there's no such element.
Ще один приклад. У веб розробці ми можемо отримати об'єкт котрий відповідає елементу на веб сторінці за допомогою стеціальних методів, наприклад: `document.querySelector('.elem')`. Проте якщо ми намагатимось отримати елемент якого немає на сторінці, то нам вернеться `null`.

@dolgachio dolgachio Jul 21, 2021

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Ще один приклад. У веб розробці ми можемо отримати об'єкт котрий відповідає елементу на веб сторінці за допомогою стеціальних методів, наприклад: `document.querySelector('.elem')`. Проте якщо ми намагатимось отримати елемент якого немає на сторінці, то нам вернеться `null`.
Ще один приклад. У веб розробці ми можемо отримати об'єкт котрий відповідає елементу на веб сторінці за допомогою спеціальних методів, наприклад: `document.querySelector('.elem')`. Проте якщо ми намагатимось отримати елемент якого немає на сторінці, то нам вернеться `null`.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread 1-js/04-object-basics/07-optional-chaining/article.md Outdated
// document.querySelector('.elem') is null if there's no element
let html = document.querySelector('.elem').innerHTML; // error if it's null
// document.querySelector('.elem') рівний null якщо такого елемента не існує
let html = document.querySelector('.elem').innerHTML; // помилка осткільки null

@dolgachio dolgachio Jul 21, 2021

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let html = document.querySelector('.elem').innerHTML; // помилка осткільки null
let html = document.querySelector('.elem').innerHTML; // помилка оскільки null

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread 1-js/04-object-basics/07-optional-chaining/article.md Outdated
};

let user2 = null;
let user2 = null; // уявимо що користувач не авторизувався

@dolgachio dolgachio Jul 21, 2021

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let user2 = null; // уявимо що користувач не авторизувався
let user2 = null; // уявімо, що користувач не авторизувався

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread 1-js/04-object-basics/07-optional-chaining/article.md Outdated

```js run
delete user?.name; // delete user.name if user exists
delete user?.name; // видалити user.name якщо користувач існує

@dolgachio dolgachio Jul 21, 2021

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
delete user?.name; // видалити user.name якщо користувач існує
delete user?.name; // видалити user.name, якщо користувач існує

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread 1-js/04-object-basics/07-optional-chaining/article.md Outdated
````warn header="We can use `?.` for safe reading and deleting, but not writing"
The optional chaining `?.` has no use at the left side of an assignment.
````warn header="Ми можемо використовувати `?.` для безпечного читання і видалення властивостей, але не для запису"
Опціональний ланцюжок `?.` не має сенсу лівій частині просвоювання.

@dolgachio dolgachio Jul 21, 2021

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Опціональний ланцюжок `?.` не має сенсу лівій частині просвоювання.
Опціональний ланцюжок `?.` не має сенсу у лівій частині просвоювання.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread 1-js/04-object-basics/07-optional-chaining/article.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread 1-js/04-object-basics/07-optional-chaining/article.md Outdated
Ланцюжок `?.` дозволяє без виникнення помилок звертатись до вкладених властивостей.

Still, we should apply `?.` carefully, only where it's acceptable that the left part doesn't exist. So that it won't hide programming errors from us, if they occur.
Тим не менш, потрібно розумно застосовувати `?.`, тільки в тих випах де допустимо що ліва частина не існує. Щоб таким чином не приховувати потенційні помилки програмування. No newline at end of file

@dolgachio dolgachio Jul 21, 2021

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Тим не менш, потрібно розумно застосовувати `?.`, тільки в тих випах де допустимо що ліва частина не існує. Щоб таким чином не приховувати потенційні помилки програмування.
Тим не менш, потрібно розумно застосовувати `?.`, тільки в тих випадках де допустимо що ліва частина не існує. Щоб таким чином не приховувати потенційні помилки програмування.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@didostap
fix grammar mistakes & add some suggestions
a7b7d89
@didostap

didostap commented Jul 21, 2021

Copy link
Copy Markdown
Contributor Author

@stas-dolgachov дякую за коментарі, все поправив
Прогнав додатково текст через сервіс, він дозволив виявити ще більше орфографічних, граматичних і лексичних помилок. В подальшому всім рекомендую використовувати.

dolgachio and tarasyyyk reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tarasyyyk tarasyyyk mentioned this pull request Jul 23, 2021
Ukrainian Translation Progress #1
Open
@tarasyyyk
minor fiixes
a88780a
@tarasyyyk
tarasyyyk merged commit c226523 into javascript-tutorial:master Jul 25, 2021
@tarasyyyk

tarasyyyk commented Jul 25, 2021

Copy link
Copy Markdown
Collaborator

@all-contributors add @didostap for translation

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@allcontributors allcontributors Bot mentioned this pull request Jul 25, 2021
docs: add didostap as a contributor for translation #152
Merged
@allcontributors

allcontributors Bot commented Jul 25, 2021

Copy link
Copy Markdown
Contributor

@tarasyyyk

I've put up a pull request to add @didostap! 🎉

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tarasyyyk

tarasyyyk commented Jul 25, 2021

Copy link
Copy Markdown
Collaborator

@all-contributors add @stas-dolgachov for review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@allcontributors allcontributors Bot mentioned this pull request Jul 25, 2021
docs: add stas-dolgachov as a contributor for review #153
Merged
@allcontributors

allcontributors Bot commented Jul 25, 2021

Copy link
Copy Markdown
Contributor

@tarasyyyk

I've put up a pull request to add @stas-dolgachov! 🎉

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@dolgachio dolgachio dolgachio left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

review needed

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@didostap @CLAassistant @tarasyyyk @dolgachio @javascript-translate-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.