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/05-data-types/03-string/article.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -140,37 +140,37 @@ Zdarza się, że osoby z praktyką w innych językach przypadkowo dodają nawias
140
140
Należy pamiętać, że `str.length` jest właściwością numeryczną, a nie funkcją. Nie ma potrzeby dodawania po nim nawiasu.
141
141
```
142
142
143
-
## Accessing characters
143
+
## Dostęp do znaków
144
144
145
-
To get a character at position `pos`, use square brackets `[pos]` or call the method [str.charAt(pos)](mdn:js/String/charAt). The first character starts from the zero position:
145
+
Aby uzyskać znak w pozycji `pos`, użyj nawiasów kwadratowych `[pos]` lub wywołaj metodę [str.charAt(pos)](https://developer.mozilla.org/pl/docs/Web/JavaScript/Reference/Global_Objects/String/charAt). Pierwszy znak zaczyna się od pozycji zerowej:
146
146
147
147
```js run
148
148
let str = `Hello`;
149
149
150
-
// the first character
150
+
// zwraca pierwszy znak
151
151
alert( str[0] ); // H
152
152
alert( str.charAt(0) ); // H
153
153
154
-
// the last character
154
+
// zwraca ostatni znak
155
155
alert( str[str.length - 1] ); // o
156
156
```
157
157
158
-
The square brackets are a modern way of getting a character, while`charAt`exists mostly for historical reasons.
158
+
Nawiasy kwadratowe to nowoczesny sposób na uzyskanie znaku, natomiast`charAt`istnieje głównie ze względów historycznych.
159
159
160
-
The only difference between them is that if no character is found, `[]`returns`undefined`, and`charAt`returns an empty string:
160
+
Jedyna różnica między nimi polega na tym, że jeśli nie zostanie znaleziony żaden znak, `[]`zwraca`undefined`, a`charAt`zwraca pusty ciąg:
0 commit comments