Skip to content

Object to primitive conversion #154

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

Conversation

MykolaSopiha
Copy link
Collaborator

No description provided.

@MykolaSopiha MykolaSopiha changed the title Object to primitive Object to primitive conversion Jul 25, 2021
Copy link
Collaborator

@tarasyyyk tarasyyyk left a comment

Choose a reason for hiding this comment

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

Дякую за переклад!
Додав пару нових рядків, щоб номери рядків збігалися з оригінальним текстом.

@javascript-translate-bot
Copy link
Contributor

Thank you 💖 I updated the Progress Issue #1 🎉 🎉 🎉

@UkrainianCitizen
Copy link
Contributor

UkrainianCitizen commented Jul 30, 2021

Еммммммм................. я почав робити рев'ю, а ти замерджив
@tarasyyyk

@UkrainianCitizen
Copy link
Contributor

UkrainianCitizen commented Jul 30, 2021

Там були граматичні, семантичні та помилки перекладу


JavaScript doesn't exactly allow to customize how operators work on objects. Unlike some other programming languages, such as Ruby or C++, we can't implement a special object method to handle an addition (or other operators).
JavaScript не дозволяє налаштувати, як працюють оператори з об’єктами. На відміну від деяких інших мов програмування, таких як Ruby або C++, ми не можемо реалізувати спеціальний об’єктний метод для обробки додавання (або інших операторів).
Copy link
Contributor

Choose a reason for hiding this comment

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

Кома перед як не потрібна. Деяких можна забрати. Краще метод об'єкта.


In case of such operations, objects are auto-converted to primitives, and then the operation is carried out over these primitives and results in a primitive value.
У разі таких операцій об’єкти автоматично перетворюються на примітиви, а потім операція здійснюється над цими примітивами та повертає результат у вигляді примітивного значення.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
У разі таких операцій об’єкти автоматично перетворюються на примітиви, а потім операція здійснюється над цими примітивами та повертає результат у вигляді примітивного значення.
У разі таких операцій, об’єкти автоматично перетворюються на примітиви, далі операція виконується над цими примітивами, що закінчується поверненням результату як примітивного значення.

https://onlinecorrector.com.ua/uk/%D0%BF%D0%BE%D0%B4%D1%96%D0%B1%D0%BD%D0%B8%D0%B9-%D0%B4%D0%BE-%D1%8F%D0%BA/


E.g. we can't make objects representing vectors or matrices (or archievements or whatever), add them and expect a "summed" object as the result. Such architectural feats are automatically "off the board".
Наприклад, ми не можемо зробити об’єкти, що представляють вектори або матриці (або досягнення або що завгодно) та додати їх і очікувати, що "підсумковий" результат буде об’єктом. Автоматично такі архітектурні особливості недоступні.
Copy link
Contributor

Choose a reason for hiding this comment

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

В реченнні немає сенсу, дослівний необдуманий переклад.
Старайтеся перекладати правильно, а не дослівно, будь ласка

Suggested change
Наприклад, ми не можемо зробити об’єкти, що представляють вектори або матриці (або досягнення або що завгодно) та додати їх і очікувати, що "підсумковий" результат буде об’єктом. Автоматично такі архітектурні особливості недоступні.
Наприклад, ми не можемо створити об’єкти, що являють собою вектори або матриці (або досягнення або щось інше), додати їх та очікувати, що результат буде об’єктом. Автоматично такі архітектурні "трюки" недоступні.

Пудсумковий результат - тавтологія
https://onlinecorrector.com.ua/uk/%D0%B1%D1%83%D1%82%D0%B8-%D1%8F%D0%B2%D0%BB%D1%8F%D1%82%D0%B8-%D1%81%D0%BE%D0%B1%D0%BE%D1%8E/


We have two purposes:
У нас є два цілі:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
У нас є два цілі:
У нас є дві цілі:


1. It will allow us to understand what's going on in case of coding mistakes, when such an operation happened accidentally.
2. There are exceptions, where such operations are possible and look good. E.g. subtracting or comparing dates (`Date` objects). We'll come across them later.
1. Це дозволить нам зрозуміти, що відбувається у випадку помилок коду, коли така операція відбулася випадково.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
1. Це дозволить нам зрозуміти, що відбувається у випадку помилок коду, коли така операція відбулася випадково.
1. Це дозволить нам зрозуміти, що відбувається у випадку неправильно написаного коду, коли така операція відбулася випадково.


So, because we can't do much here, there's no maths with objects in real projects. When it happens, it's usually because of a coding mistake.
Отже, оскільки ми не можемо автоматично за допомогою мови програмування виконувати подібні операції над об’єктами, то в реальних проєктах немає "математики з об’єктами". Коли стаються подібні операції (наприклад, `obj1 + obj2`), причиною цьому зазвичай є помилка програмування.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Отже, оскільки ми не можемо автоматично за допомогою мови програмування виконувати подібні операції над об’єктами, то в реальних проєктах немає "математики з об’єктами". Коли стаються подібні операції (наприклад, `obj1 + obj2`), причиною цьому зазвичай є помилка програмування.
Отже, оскільки ми тут вже нічого не можемо зробити, то в реальних проєктах немає "математики з об’єктами". Коли подібне відбувається, то причиною, зазвичай, є помилка програмування.


In the chapter <info:type-conversions> we've seen the rules for numeric, string and boolean conversions of primitives. But we left a gap for objects. Now, as we know about methods and symbols it becomes possible to fill it.
У розділі <info:type-conversions> ми бачили правила для перетворення чисел, рядків та булевих примітивів. Але ми залишили пробіл для об’єктів. Тепер, оскільки ми знаємо про методи та символи, можемо заповнити його.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
У розділі <info:type-conversions> ми бачили правила для перетворення чисел, рядків та булевих примітивів. Але ми залишили пробіл для об’єктів. Тепер, оскільки ми знаємо про методи та символи, можемо заповнити його.
У розділі <info:type-conversions>, ми бачили правила перетворення чисел, рядків та булевих примітивів. Але ми залишили прогалину щодо об’єктів. Тепер, оскільки ми знаємо про методи та символи, ми можемо заповнити її.

1. All objects are `true` in a boolean context. There are only numeric and string conversions.
2. The numeric conversion happens when we subtract objects or apply mathematical functions. For instance, `Date` objects (to be covered in the chapter <info:date>) can be subtracted, and the result of `date1 - date2` is the time difference between two dates.
3. As for the string conversion -- it usually happens when we output an object like `alert(obj)` and in similar contexts.
1. Всі об’єкти -- це `true` в булевому контексті. Є лише числові та рядкові конверсії.
Copy link
Contributor

Choose a reason for hiding this comment

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

Або коротке тире або тире . Ніяких --

1. All objects are `true` in a boolean context. There are only numeric and string conversions.
2. The numeric conversion happens when we subtract objects or apply mathematical functions. For instance, `Date` objects (to be covered in the chapter <info:date>) can be subtracted, and the result of `date1 - date2` is the time difference between two dates.
3. As for the string conversion -- it usually happens when we output an object like `alert(obj)` and in similar contexts.
1. Всі об’єкти -- це `true` в булевому контексті. Є лише числові та рядкові конверсії.
Copy link
Contributor

Choose a reason for hiding this comment

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

Краще конверсії чисел та рядків


What happens when objects are added `obj1 + obj2`, subtracted `obj1 - obj2` or printed using `alert(obj)`?
Що відбувається, коли об’єкти додаються `obj1 + obj2`, віднімаються `obj1 - obj2` або друкуються за допомогою `alert(obj)`?
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Що відбувається, коли об’єкти додаються `obj1 + obj2`, віднімаються `obj1 - obj2` або друкуються за допомогою `alert(obj)`?
Що відбувається, коли об’єкти додаються(`obj1 + obj2`), віднімаються(`obj1 - obj2`) або друкуються за допомогою `alert(obj)`?

@UkrainianCitizen
Copy link
Contributor

І я не закінчив рев'ю

@tarasyyyk
Copy link
Collaborator

Еммммммм................. я почав робити рев'ю, а ти замерджив
@tarasyyyk

Незнав, що Ви робите рев’ю.
Коли закінчите, напишіть коментар і я внесу зміни. Дякую.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants