Skip to content

Commit 78bacd5

Browse files
authored
Translated solution.md
1 parent c6e5312 commit 78bacd5

File tree

1 file changed

+7
-7
lines changed
  • 1-js/02-first-steps/06-type-conversions/1-primitive-conversions-questions

1 file changed

+7
-7
lines changed

1-js/02-first-steps/06-type-conversions/1-primitive-conversions-questions/solution.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ undefined + 1 = NaN // (6)
1717
" \t \n" - 2 = -2 // (7)
1818
```
1919

20-
1. The addition with a string `"" + 1` converts `1` to a string: `"" + 1 = "1"`, and then we have `"1" + 0`, the same rule is applied.
21-
2. The subtraction `-` (like most math operations) only works with numbers, it converts an empty string `""` to `0`.
22-
3. The addition with a string appends the number `5` to the string.
23-
4. The subtraction always converts to numbers, so it makes `" -9 "` a number `-9` (ignoring spaces around it).
24-
5. `null` becomes `0` after the numeric conversion.
25-
6. `undefined` becomes `NaN` after the numeric conversion.
26-
7. Space characters, are trimmed off string start and end when a string is converted to a number. Here the whole string consists of space characters, such as `\t`, `\n` and a "regular" space between them. So, similarly to an empty string, it becomes `0`.
20+
1. Sudėtis su eilute `"" + 1` paverčia `1` į eilutę: `"" + 1 = "1"`, o tada mes turime `"1" + 0`, taikoma ta pati taisyklė.
21+
2. Atimtis `-` (kaip ir didžioji dalis matematinių operacijų) veikia tik su skaičiais, tad tuščią eilutę `""` paverčia į `0`.
22+
3. Sudėtis su eilute prijungia skaičių `5` prie eilutės.
23+
4. Atimtis visada paverčia į numerius, tad `" -9 "` tampa numeriu `-9` (ignoruoja tarpus aplink).
24+
5. `null` tampa `0` po skaičių konversijos.
25+
6. `undefined` tampa `NaN` po skaičių konversijos.
26+
7. Tarpų ženklai yra nukerpami nuo eilutės pradžios ir pabaigos kai eilutė paverčiama į skaičių. Čia visa eilutė susideda iš tarpo ženklų kaip `\t`, `\n` ir "įprastinių" tarpų esančių tarp jų. Tad panašiai kaip ir tuščia eilutė, ji tampa `0`.

0 commit comments

Comments
 (0)