You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 1-js/02-first-steps/12-nullish-coalescing-operator/article.md
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -139,28 +139,28 @@ Kod poniżej wywołuje błąd składni:
139
139
let x =1&&2??3; // Błąd składni
140
140
```
141
141
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`||`.
143
143
144
-
Use explicit parentheses to work around it:
144
+
Używaj dokładnych nawiasów żeby uniknąć problemu:
145
145
146
146
```js run
147
147
*!*
148
-
let x = (1&&2) ??3; //Works
148
+
let x = (1&&2) ??3; //Działa
149
149
*/!*
150
150
151
151
alert(x); // 2
152
152
```
153
153
154
-
## Summary
154
+
## Podsumowanie
155
155
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.
157
157
158
-
It's used to assign default values to variables:
158
+
Jest używany do przypisania domyślnej wartości do zmiennej:
159
159
160
160
```js
161
-
//set height=100, if height is null or undefined
161
+
//ustaw height=100, jeżeli height jest null lub undefined
162
162
height = height ??100;
163
163
```
164
164
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