Skip to content

Methods of primitives #10

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 7 commits into from
May 9, 2019
Merged

Methods of primitives #10

merged 7 commits into from
May 9, 2019

Conversation

stevermeister
Copy link
Contributor

No description provided.

@CLAassistant
Copy link

CLAassistant commented May 8, 2019

CLA assistant check
All committers have signed the CLA.

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.

@stevermeister you did a great work. I found some small remarks which need to be resolved before merging.

@@ -1,22 +1,22 @@
# Methods of primitives
Copy link
Collaborator

Choose a reason for hiding this comment

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

Article title not translated


- Is a value of a primitive type.
- There are 6 primitive types: `string`, `number`, `boolean`, `symbol`, `null` and `undefined`.
- є Is a value of a primitive type.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove this line "Is a value of a primitive type."


З іншого боку, використання тих же самих функцій `String / Number / Boolean` без` new` є абсолютно розумною і корисною річчю. Вони перетворюють значення у відповідний тип: до рядка, числа або булевого (примітиву).

Наприклад, це цілком справедливо:
For example, this is entirely valid:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove "For example, this is entirely valid:"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

was not sure about good translation in this place, maybe you have ideas?

Copy link
Collaborator

Choose a reason for hiding this comment

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

"Наприклад, такий вираз цілком правильний:"
or
"Наприклад, це/так цілком правильно:"


З іншого боку, використання тих же самих функцій `String / Number / Boolean` без` new` є абсолютно розумною і корисною річчю. Вони перетворюють значення у відповідний тип: до рядка, числа або булевого (примітиву).

Наприклад, це цілком справедливо:
For example, this is entirely valid:
```js
let num = Number("123"); // convert a string to number
Copy link
Collaborator

Choose a reason for hiding this comment

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

Comment also can be translated


```js run
alert(null.test); // error
````

## Summary
## Виводи
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's better to translate "Summary" as "Висновки" or "Підсумки"


З іншого боку, використання тих же самих функцій `String / Number / Boolean` без` new` є абсолютно розумною і корисною річчю. Вони перетворюють значення у відповідний тип: до рядка, числа або булевого (примітиву).

Наприклад, це цілком справедливо:
For example, this is entirely valid:
Copy link
Collaborator

Choose a reason for hiding this comment

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

"Наприклад, такий вираз цілком правильний:"
or
"Наприклад, це/так цілком правильно:"

@@ -126,7 +126,7 @@ let num = Number("123"); // convert a string to number
alert(null.test); // error
Copy link
Collaborator

Choose a reason for hiding this comment

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

translate comment: // помилка

@@ -1,5 +1,5 @@

Try running it:
Спробуйте запустити:

```js run
let str = "Hello";
Copy link
Collaborator

Choose a reason for hiding this comment

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

let str = "Привіт";

1. `undefined`
2. An error.
2. помилка.
Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. помилку.



Consider the following code:
Розглянемо наступний код:

```js
let str = "Hello";
Copy link
Collaborator

Choose a reason for hiding this comment

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

let str = "Привіт";


Objects are "heavier" than primitives. They require additional resources to support the internal machinery. But as properties and methods are very useful in programming, JavaScript engines try to optimize them to reduce the additional burden.
Об'єкти "важче", ніж примітиви. Вони вимагають додаткових ресурсів для підтримки внутрішньої обробки. Але, оскільки властивості і методи дуже корисні в програмуванні, двигун JavaScript намагається оптимізувати їх для зменшення додаткового навантаження.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Об'єкти "важчі" за примітиви.


Here's how it works:
Ось як він працює:

```js run
let str = "Hello";
Copy link
Collaborator

Choose a reason for hiding this comment

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

let str = "Привіт";
...
// ПРИВІТ

1. The string `str` is a primitive. So in the moment of accessing its property, a special object is created that knows the value of the string, and has useful methods, like `toUpperCase()`.
2. That method runs and returns a new string (shown by `alert`).
3. The special object is destroyed, leaving the primitive `str` alone.
1. Рядок `str` є примітивом. Тому під час звернення до його властивості створюється спеціальний об'єкт, який знає значення рядка і має корисні методи, такі як `toUpperCase ()`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

toUpperCase() - without space


```js run
let zero = new Number(0);

if (zero) { // zero is true, because it's an object
if (zero) { // zero є true, тому що це об'єкт
alert( "zero is truthy?!?" );
Copy link
Collaborator

Choose a reason for hiding this comment

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

alert( "чи zero є true?!?" );


З іншого боку, використання тих же самих функцій `String / Number / Boolean` без` new` є абсолютно розумною і корисною річчю. Вони перетворюють значення у відповідний тип: до рядка, числа або булевого (примітиву).
Copy link
Collaborator

Choose a reason for hiding this comment

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

remove space before new

@stevermeister
Copy link
Contributor Author

@tarasyyyk thank you for detailed review! all places were updated accordingly to the comments

@tarasyyyk tarasyyyk merged commit 96163a4 into javascript-tutorial:master May 9, 2019
@tarasyyyk
Copy link
Collaborator

@stevermeister found some fresh changes to English version:
javascript-tutorial/en.javascript.info@1ba420f
Would be good to translate them as well.

@stevermeister
Copy link
Contributor Author

stevermeister commented May 9, 2019

@tarasyyyk yes, sure
here you are
https://github.com/javascript-tutorial/uk.javascript.info/pull/11/files

and could you please update untranslated parts of this repo with actual en origin?

javascript-translate-bot pushed a commit that referenced this pull request Nov 11, 2019
Adding some mention of implicit `<tbody>` element. Comes up later in Modifying the Document task #10 solution.
@tarasyyyk
Copy link
Collaborator

Thanks for your contribution!
@all-contributors add @stevermeister for translation.

@allcontributors
Copy link
Contributor

@tarasyyyk

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

@tarasyyyk tarasyyyk changed the title Data types > Methods of primitives Methods of primitives Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants