Skip to content

Commit 20aaed3

Browse files
authored
Typo: occurences
Update from "occurences" to "occurrences"
1 parent 144a2fe commit 20aaed3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

1-js/05-data-types/03-string/article.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ alert( str.indexOf("id") ); // 1, "id" is found at the position 1 (..idget with
236236

237237
The optional second parameter allows us to search starting from the given position.
238238

239-
For instance, the first occurence of `"id"` is at position `1`. To look for the next occurence, let's start the search from position `2`:
239+
For instance, the first occurrence of `"id"` is at position `1`. To look for the next occurrence, let's start the search from position `2`:
240240

241241
```js run
242242
let str = 'Widget with id';
@@ -280,7 +280,7 @@ while ((pos = str.indexOf(target, pos + 1)) != -1) {
280280
```smart header="`str.lastIndexOf(pos)`"
281281
There is also a similar method [str.lastIndexOf(pos)](mdn:js/String/lastIndexOf) that searches from the end of a string to its beginning.
282282

283-
It would list the occurences in the reverse order.
283+
It would list the occurrences in the reverse order.
284284
```
285285
286286
There is a slight inconvenience with `indexOf` in the `if` test. We can't put it in the `if` like this:

0 commit comments

Comments
 (0)