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
If we're interested in all occurences, we can run `indexOf` in a loop. Every new call is made with the position after the previous match:
248
+
If we're interested in all occurrences, we can run `indexOf` in a loop. Every new call is made with the position after the previous match:
249
249
250
250
251
251
```js run
@@ -295,7 +295,7 @@ if (str.indexOf("Widget")) {
295
295
296
296
The `alert` in the example above doesn't show, because `str.indexOf("Widget")` returns `0` (meaning that it found the match at the starting position). Right, but `if` considers that to be `false`.
0 commit comments