Skip to content

Commit 270905c

Browse files
Bartłomiej Kalembasculpt0r
Bartłomiej Kalemba
authored andcommitted
All translated - raw
1 parent 14c2d04 commit 270905c

File tree

1 file changed

+9
-9
lines changed
  • 1-js/02-first-steps/12-nullish-coalescing-operator

1 file changed

+9
-9
lines changed

1-js/02-first-steps/12-nullish-coalescing-operator/article.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -139,28 +139,28 @@ Kod poniżej wywołuje błąd składni:
139139
let x = 1 && 2 ?? 3; // Błąd składni
140140
```
141141
142-
The limitation is surely debatable, but it was added to the language specification with the purpose to avoid programming mistakes, when people start to switch to `??` from `||`.
142+
Obostrzenia są oczywiście dyskusyjne, ale zostały dodane do specyfikacji języka celem uniknięcia błędów programowania, kiedy ludzie zaczną zmieniać z `??` na `||`.
143143
144-
Use explicit parentheses to work around it:
144+
Używaj dokładnych nawiasów żeby uniknąć problemu:
145145
146146
```js run
147147
*!*
148-
let x = (1 && 2) ?? 3; // Works
148+
let x = (1 && 2) ?? 3; // Działa
149149
*/!*
150150

151151
alert(x); // 2
152152
```
153153
154-
## Summary
154+
## Podsumowanie
155155
156-
- Operator łączenia wartości null `??` provides a short way to choose the first "defined" value from a list.
156+
- Operator łączenia wartości null `??` dostarcza szybszego sposobu na wybranie pierwszej zdefiniowanej wartości z listy.
157157
158-
It's used to assign default values to variables:
158+
Jest używany do przypisania domyślnej wartości do zmiennej:
159159
160160
```js
161-
// set height=100, if height is null or undefined
161+
// ustaw height=100, jeżeli height jest null lub undefined
162162
height = height ?? 100;
163163
```
164164
165-
- The operator `??` has a very low precedence, only a bit higher than `?` and `=`, so consider adding parentheses when using it in an expression.
166-
- It's forbidden to use it with `||` or `&&` without explicit parentheses.
165+
- Operator `??` ma bardzo niski priorytet, tylko trochę wyższy niż `?` i `=`, zatem rozważ dodanie nawiasów w wyrażeniu.
166+
- Zabronione jest użycie z `||` lub `&&` bez użycia nawiasów.

0 commit comments

Comments
 (0)