-
Notifications
You must be signed in to change notification settings - Fork 180
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
Methods of primitives #10
Conversation
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.
@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 |
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.
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. |
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.
Remove this line "Is a value of a primitive type."
|
||
З іншого боку, використання тих же самих функцій `String / Number / Boolean` без` new` є абсолютно розумною і корисною річчю. Вони перетворюють значення у відповідний тип: до рядка, числа або булевого (примітиву). | ||
|
||
Наприклад, це цілком справедливо: | ||
For example, this is entirely valid: |
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.
Remove "For example, this is entirely valid:"
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.
was not sure about good translation in this place, maybe you have ideas?
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.
"Наприклад, такий вираз цілком правильний:"
or
"Наприклад, це/так цілком правильно:"
|
||
З іншого боку, використання тих же самих функцій `String / Number / Boolean` без` new` є абсолютно розумною і корисною річчю. Вони перетворюють значення у відповідний тип: до рядка, числа або булевого (примітиву). | ||
|
||
Наприклад, це цілком справедливо: | ||
For example, this is entirely valid: | ||
```js | ||
let num = Number("123"); // convert a string to number |
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.
Comment also can be translated
|
||
```js run | ||
alert(null.test); // error | ||
```` | ||
|
||
## Summary | ||
## Виводи |
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.
It's better to translate "Summary" as "Висновки" or "Підсумки"
|
||
З іншого боку, використання тих же самих функцій `String / Number / Boolean` без` new` є абсолютно розумною і корисною річчю. Вони перетворюють значення у відповідний тип: до рядка, числа або булевого (примітиву). | ||
|
||
Наприклад, це цілком справедливо: | ||
For example, this is entirely valid: |
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.
"Наприклад, такий вираз цілком правильний:"
or
"Наприклад, це/так цілком правильно:"
@@ -126,7 +126,7 @@ let num = Number("123"); // convert a string to number | |||
alert(null.test); // error |
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.
translate comment: // помилка
@@ -1,5 +1,5 @@ | |||
|
|||
Try running it: | |||
Спробуйте запустити: | |||
|
|||
```js run | |||
let str = "Hello"; |
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.
let str = "Привіт";
1. `undefined` | ||
2. An error. | ||
2. помилка. |
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.
- помилку.
|
||
|
||
Consider the following code: | ||
Розглянемо наступний код: | ||
|
||
```js | ||
let str = "Hello"; |
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.
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 намагається оптимізувати їх для зменшення додаткового навантаження. |
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.
Об'єкти "важчі" за примітиви.
|
||
Here's how it works: | ||
Ось як він працює: | ||
|
||
```js run | ||
let str = "Hello"; |
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.
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 ()`. |
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.
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?!?" ); |
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.
alert( "чи zero є true?!?" );
|
||
З іншого боку, використання тих же самих функцій `String / Number / Boolean` без` new` є абсолютно розумною і корисною річчю. Вони перетворюють значення у відповідний тип: до рядка, числа або булевого (примітиву). |
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.
remove space before new
@tarasyyyk thank you for detailed review! all places were updated accordingly to the comments |
@stevermeister found some fresh changes to English version: |
@tarasyyyk yes, sure and could you please update untranslated parts of this repo with actual en origin? |
Adding some mention of implicit `<tbody>` element. Comes up later in Modifying the Document task #10 solution.
Thanks for your contribution! |
I've put up a pull request to add @stevermeister! 🎉 |
No description provided.